The optimize(w, b, X, Y,…) function fails on the 3rd iteration of the loop with:
<ipython-input-45-3390ca990601> in optimize(w, b, X, Y, num_iterations, learning_rate, print_cost)
40 ...
---> 42 grads, cost = ...
43 # YOUR CODE ENDS HERE
<ipython-input-48-b5e684413ba0> in propagate(w, b, X, Y)
---> 37 A = sigmoid(...)
38 # YOUR CODE ENDS HERE
ValueError: operands could not be broadcast together with shapes (2,3) (2,2)
It’s odd because the propagate function already passes the tests so it should just be a matter of passing in the w,b,X,Y vars. When I print the sigmoid( vars ), the vars are the correct shape (wT:(2,2), X:(2,3)) for a dot product but the +b seems to be the wrong shape (2,2). Shouldn’t it also be (2,3)? Is this a test problem?
Actually, if m=3 then I think b.shape = (1,3).
I think it is a test problem with excercise 6 because I use the same sigmoid func in exercise 7 and all tests pass.