Why does the output layer has Y.shape[0] as the input size , it should be 1 ,as we just want 1 output . By using y.shape[0] as the input size for the output layer size , we will get Y.shape[0] number of output ?
The layer_sizes
function is a general purpose function. It must be written to handle any size of inputs and outputs, not just to match the actual “real” data we are using in this exercise. If you were going to just hard-code everything to 2 inputs and 1 output, then what would be the point of writing this function in the first place?
Yes, and it happens that for the real data we use Y.shape[0]
is 1, right? So it all works out with the general purpose implementation of the function. But be careful that when writing the internals of the layer_sizes
function, you reference the parameter values that are passed in and not the global variables that define the real data.