W4_A2 L_layer_model cost after iteration mismatch

Hi there,

In section 5.1 (Train the model) when I run the first cell to train the model, I get different cost after iteration 0 (and subsequent iterations) compared to the expected output. Here is what I get:

While the expected output is:

  • Cost after iteration 0: 0.771749
  • Cost after iteration 100: 0.672053

All the previous cells run correctly and pass the tests. I don’t understand the reason for the discrepancy.

Any ideas?

Thanks,
Azadeh

Hi @Azadeh_Faridi_Ermaga,

Sometimes the outputs can differ in computation. All tests passed is indicating that you have passed the test. Once you submit to the autograder, if there will be any error, you’ll know.

Best,
Mubsi

Are you sure you ran all the cells of the notebook in order? It’s a common mistake to skip running the cell that redefines layers_dims to be the 4 layer network. So you’re running the L layer test, but with the two layer network. Try “Kernel → Restart and Clear Output” followed by “Cell → Run All” and see if you then get consistent results.

Thanks @paulinpaloalto! This must have been the problem. Although it surprises me because before posting here I also tried Cell > Run All Above and got the same result. But it seems restarting did the trick. Thank you!

Thanks @Mubsi! The grader did not give any errors. So it was OK in the end.