https://colab.research.google.com/drive/1CloOFEM3QFItsbIba7Ex7NEKC8nJf3_A?usp=sharing

Could you print the input shapes

Please reshape Y_train to (-1,1), if it is not

I tried your notebook, and generated random numbers for X and Y where Y’s dimension was (63,)

As a result, the first step in backprop i.e `self.dA2 = self.H2 - Y `

gives an output of (63,63) instead of (63,1) due to broadcasting operation.

It would work well if Y was of shape (63,1)

2 Likes

Inside class FF_MultiClass_InputWeightVectorised,

change the following inside ** grad** function.

self.dA2 = self.H2 - Y

to

self.dA2 = self.H2 - Y.reshape(-1, 1)

Right now, `Y`

is 1-dim and you need to force it to a 2-d with 1 column otherwise automatic broadcast will make the operation incorrect.

Just noticed, I just duplicated what @databaaz wrote in his reply

2 Likes