W2 - last assignment - test cell after optimization function - assertion error


Could someone help me please?
I have run all the cells before this cell and the answers were right for all of them, however there is an error in this cell and I don’t know how to fix it regarding the right code for all the cells before.

1 Like

Hi @Rosa_Adibrad ,

The output from your screenshot showed there are problem with w, b and dw and db; but the Costs looked OK. It could be the execution environment is not quite right. I suggest you restart the kernel and clear all output, then rerun the code from the beginning to see if that would work.

1 Like

Notice that your first cost value is correct, but it is the second one that differs in the failing assertion. That means your cost calculations in propagate are correct, but we already knew that from the fact that the earlier tests passed. The difference between the first value and the second is that the first one is at 0 iterations, before the “update parameters” logic has done its work. So this means that the bug is probably in how you implemented that logic, which is part of the optimize function, right? Please start by carefully comparing your code to the instructions for that logic. Are you adding instead of subtracting? Did you use the correct gradients for w and for b? Check those kinds of issues.

1 Like

That was the problem!
Thank you so muck for your kind help :pray: :tulip:

1 Like