C1_W2 Assignment

Hi Guys,
I am currently on the last programming assignment, I am working on deriving the cost function(using np.log() and np.dot()) to calculate dw and db, but I keep getting this error ValueError: shapes (2,3) and (1,1) not aligned: 3 (dim 1) != 1 (dim 0)
Any tips and suggestions will be appreciated. I am losing my mind already. :tired_face:

If you lost the way, it is time to start the dimension analysis. It’s not a hard task, but just adding print function to check the shape of each variable step by step.

For example, in the case of the first test,

X.shape = (2,3)
Y.shape = (1,3)
w.shape = (2,1)
b = (float)

The first mathematical operation is a dot product of β€œw” and β€œX”. But, if we look at the shape, we can easily understand that we need to transpose β€œw”. Then, A, the output from a sigmoid function, should be;
A.shape = (1,3)
Same method should be applied to the cost calculation.

By checking one by one, you will find the point that you fail to control the dimension of a variable.