C2W2 Optimize Test Error

When I test the my Optimize function, it passes, even though I think it has the wrong values for w. Then, when I run model test, my w values fail.

Here are the results from my Optimize test:

w = [[0.35627617]
[0.60199214]]
b = -0.14956979978997245
dw = [[-0.21189539]
[-0.33376766]]
db = -0.13290329100668047
Costs = [array(0.5826722)]
All tests passed!

I think, from the test code, they should be:

The grader tests your code using different tests than those in the notebook.

Maybe your code fails the notebook unit tests, but passes the grader’s tests.

It needs fixing in either case.

There are two different tests for the optimize function: one directly in the notebook and one in the file public_tests.py.

If optimize passes the tests, but model fails, then that means your model code is probably calling optimize incorrectly. The most common type of error is “hard-coding” parameters or just relying on the default values: you have to respect the actual values being requested by the test for all the parameters like learning rate and number of iterations.

1 Like