I'm going through the "Make Your Own Neural Networks" book and following through the examples to implement my first NN. I understood the basic concepts and in particular this equation where the output is calculated doing a matrix dot product of the inputs and weights:
X = W * I
Where X is the output before applying the Sigmoid, W the link weights and I the inputs.
Now in the book, they do have a function that takes in this input as an array and then they translate that array to a 2 dimensional one. My understanding is that, the value of X is calculated like this based on:
W = [0.1, 0.2, 0.3
0.4, 0.5, 0.6
0.7, 0.8, 0.9]
I = [1
2
3]
So if I now pass in an array for my inputs like [1,2,3], why is that I need do the following to have it converted to a 2-D array as it is done in the book:
inputs = numpy.array(inputs, ndmin=2).T
Any ideas?
nrows representing the observations, andmcolumns representing the features. In your case, you only have1feature, your input (which is also what you are trying to predict) and3observations. In other words it's more like a convention which happens to be useful for understanding how you use and store data.inputsare always two-dimensional, you make sure that the orientation of the resulting dot-productnp.dot(W, I)is always a column vector for each feature (each independent variable/combination, etc... has its "own" row), independently of the number of features. F.i. forn_features=1and withndmin=1, you'd get a row-vector fromnp.dot(W, I),