Week2 Assignment 2 exercise 8 wrong values for dw

Can someone please help me with the following error.
I tried changing initialisation of ‘w’ but it didn’t work. Thanks for the help in advance.

1 Like

Rupa I have the same problem.

AssertionError: Wrong values for d[‘w’]. [[ 0.28154433]
[-0.11519574]
[ 0.13142694]
[ 0.20526551]] != [[ 0.00194946]
[-0.0005046 ]
[ 0.00083111]
[ 0.00143207]]

Hi Dwan,
Thanks for sharing your output. I have been reviewing and trying to debug by printing dw and db values but wasn’t really successful in overcoming the problem. The error message in my case says "wrong type for d[‘w’] and != np.ndarray.

I also noticed (in exercise 5 testing) before calling propagate function for testing, they used assert to make sure the grad[‘dw’] was an ndarray (the code below was used before calling propagate function.

assert type(grads[“dw”]) == np.ndarray
assert grads[“dw”].shape == (2, 1)
assert type(grads[“db”]) == np.float64

Any clues from this which might help us solve the problem?


I am getting the same issue and I am not sure what the problem is.

After some digging around, I was able to fix the issue! It looks like I was calling my optimize function without using all of the parameters. Here’s a link to a helpful thread that helped me out: Week 2 Programming Assignment Logistic Regression with a Neural Network Mindset

7 Likes

Thanks Victor. That was really helpful.
I submitted my assignment without correcting the problem and passed, but I will revisit my assignment now to sort out the problem.
Thanks again.

thanks so much, I was going bananas trying to figure this out!

Ah I made the same mistake too! Thanks!