mdseck
February 9, 2025, 4:24am
1
Getting an error
in propagate(w, b, X, Y)
32 # YOUR CODE STARTS HERE
33
—> 34 A = sigmoid(np.dot (w.T , X) + b)
35
36 cost = (-1/m)* np.sum(Y*np.log(A) + (1-Y)*np.log(1-A) )
<array_function internals> in dot(*args, **kwargs)
ValueError: shapes (1,2) and (4,7) not aligned: 2 (dim 1) != 4 (dim 0)
Even though this function produced te correct output in the previous tests.
TMosh
February 9, 2025, 4:31am
2
Maybe those other tests used a different size fro the variables w or X or b.
Your code must work with any set of data.
Check if you have perhaps hard-coded some values or sizes.
mdseck
February 9, 2025, 4:34am
3
I did not use hard coded values…
Does the test in exercise 8 require reshaping the images in the training set?
mdseck
February 9, 2025, 4:54am
4
I was setting the shape of w wrongly. Solved. Thank you!
1 Like