Logistic_Regression_with_a_Neural_Network_mindset propagate()


I can’t get propagate to pass propagate_test. According to propagate_test, I only get db correctly.

I really don’t get what could be wrong with my code. Is there any way I can have someone review it without breaking coursera’s honor code?

This is the error message:

dw = [[-0.00154399]
db = 0.0014555781367842193
cost = 0.0015453193941501516

AssertionError Traceback (most recent call last)
14 print ("cost = " + str(cost))
—> 16 propagate_test(propagate)

~/work/release/W2A2/public_tests.py in propagate_test(target)
37 assert type(grads[‘dw’]) == np.ndarray, f"Wrong type for grads[‘dw’]. {type(grads[‘dw’])} != np.ndarray"
38 assert grads[‘dw’].shape == w.shape, f"Wrong shape for grads[‘dw’]. {grads[‘dw’].shape} != {w.shape}"
—> 39 assert np.allclose(grads[‘dw’], expected_dw), f"Wrong values for grads[‘dw’]. {grads[‘dw’]} != {expected_dw}"
40 assert np.allclose(grads[‘db’], expected_db), f"Wrong values for grads[‘db’]. {grads[‘db’]} != {expected_db}"
41 assert np.allclose(cost, expected_cost), f"Wrong values for cost. {cost} != {expected_cost}"

AssertionError: Wrong values for grads[‘dw’]. [[-0.00154399]
[-0.00492761]] != [[0.99845601]

I would like to add that I take all the arguments as they are in propagate. I’m not altering them in any way.

I also passed optimize using my propagate-implementation. Weird.

Hey @Isak, if you could share your notebook with me, I’d be able to help you better. Thanks.

1 Like