Week 4 Exercise 5 - L_model_forward

When I did Exercise 5 for week 4 the grader marked my answer as correct

Screenshot 2021-07-25 at 11.24.36

However when I run the training function, my outputs do not match the expected outputs.
Screenshot 2021-07-25 at 11.34.28
Screenshot 2021-07-25 at 11.34.40

Is my code wrong even though the grader marks it as correct?

Any help will be greatly appreciated

One common mistake is not to run the cell that redefines layers_dims to be the 4 layer network. That is separate from the L_layer_model cell. So you may be running the training on the same 2 layer net as before. Another mistake would be to “hand import” your own version of the subroutines from the “Step by Step” exercise. If you do that, you will also get different results.

I’ll bet it’s the layers_dims error: I just purposely did that and get the same values you show for 0 and 100 iterations. So you’re just training a different network, which is why the results are different.

1 Like

Thank you very much, That solved my problem. I just forgot to run the cell that changed the dimensions.