My exercise 5 passes, but in exercise 6 I get: AssertionError: Wrong values for costs. [array(5.80154737), array(0.71089735)] != [5.80154532, 0.31057104]

I do:

and:

The cost also decreases, when I print the result in each itteration:

But it seem the learning rate is to low or there are more iterations needed?
I can’t figure the problem. Please help.

You can see from the values shown in the assertion failure that even your value of the cost at iteration 0 is wrong: an error in the 6th decimal place is not a rounding error. Your implementation of the first term (the Y = 1 term) is not correct. And at iteration 0, the gradients don’t yet have any effect, which is the clue that the bug must be in either the computation of A or the cost.

Then there must also be a problem that either you’re hard-coding the learning rate to the wrong value or perhaps your gradient computations are incorrect. Please compare your code to the formulas with the same level of attention to detail that was necessary to spot the error in your cost formula and see if you notice anything further.

Indeed! It is a good point that both the test cases in the notebook and the grader report that bug as a problem in optimize, not in propagate. Heavy sigh. Thanks for pointing that out! I will file a bug about that right away …