Week 1 Course 1 Programming Assignment

I am getting values ~0.003 off for dL/dw and dL/db. I believe there is a float error, but I do not see where this could occur. I am unable to move on in the programming assignment due to the assertion error. Suggestions for what the problem could be would be appreciated.

An error in the third decimal place is not a rounding error. There is something wrong in your code. Note that all your values are off, including the cost. The one thing that is common to all of them is the A value. Try adding a print statement to show the A value. E.g. here’s what I get from adding that to my code which passes the test case:

A = [[0.99987661 0.99999386 0.00449627]]
dw = [[0.99845601]
db = 0.001455578136784208
cost = 5.801545319394553
A = [[0.99987661 0.99999386 0.00449627]]
All tests passed!

Notice that all my other values agree with the “expected values” shown in the notebook. What do you see for A? I’m going to guess that you get this:

A = [[0.99908895 0.9999546 0.00061088]]

You need to carefully compare your code for computing A to the mathematical formula that was shown in the instructions. You omitted one key piece of the formula.

I see where my mistake lies, thank you.

1 Like