I want to execute
for b, w in zip(self.biases, self.weights):
a= sigmoid(np.dot(w, a) + b)
where,
a is a tuple of length 784
,
self.biases contains a list of matrices of dimensions (15, 1)
and (10, 1)
,
self.weights contains a list of matrices of dimensions (15, 784)
and (10, 15)
.
So, I am basically calculating w.a + b
in each pass through the loop. Upon doing this calculation with w of size (15, 784)
, a of length 784 and b of size (15, 1)
, I should get the resultant matrix of size (15, 1)
but I am getting (15, 15)
.
To debug, I tried to analyse by printing the various matrices involved and I found that if I removed + b
from the above line of code, I get the dimensions of the resultant matrix as (15,)
.
So, I am guessing that the bug should be because of some inadequate type of matrix broadcasting happening in the code.
I tried to remove the bug by adding the following lines of code before the for loop:
a= np.array(a)
np.reshape(a, (784, 1))
But it failed to improve the result.
Please help..