What Data Structure Do I use?
Hello Everyone!
Creating a Neural Network from Scratch has been on my mind for the last few months. So, I have finally converted my thoughts to action!
I am going to try to create neural networks from scratch, i.e., without using libraries like Tensorflow and PyTorch.
While creating the basic roadmap, I came across the following:
1) What kind of data structure should I use for each neuron?
After a bit of looking around: The answer is numpy arrays.
Why Numpy arrays over Lists?
- Each item of a list is a pointer to a memory location that actually contains the value. (And this is why lists can store items of different data types)
- Each item of a list is a pointer to a memory location that actually contains the value. (And this is why lists can store items of different data types)
- Each item in a numpy array is stored in contiguous memory locations (they are written in C++).
-This means that each time a list value is retrieved there are two visits to memory locations, but when a numpy array value is retrieved, there is only one memory location to go to.
I hope to understand more about numpy arrays - the way they use memory.
2) How to use calculus in Python?
Answer: Using the module SymPy
Next step: Creating a single layer Perceptron Model.
Comments
Post a Comment