This is for the Week 3, Planar Data Classification.
I had completed all functions preceding nn_model, and all test cases passed successfully. However, when I ran nn_model, I received an AssertionError, after the statement that 1/3 test cases had failed, stating that I should review my equations and make sure I hadn’t called any global variables.
I checked this, and found no discrepancies.
However, a couple of hours later, I realized that initially, np.random is seeded with 2. This is reset to being seeded with 3 in the code within nn_model. The test cases are likely using seed 2, and when I changed this seed to 2, the function passed all tests, and I was able to proceed. I worked on this notebook on the 30th and 31st of May for reference. I just wanted to put this out there, in case any correction needs to be made.
Thanks!
You should not need to modify any of the seeds in order to succeed in this assignment. I did not have any problem with this. Notice that the seed is set in the initialization routine, so the value set in nn_model is essentially meaningless: it is not used for anything because it gets over-ridden by the value in initialize_parameters.
@paulinpaloalto
Thank you for your quick response! It makes sense to me that modifying the seeds shouldn’t be required, and this is likely not a common error; I don’t see many other posts with this error. I actually initialized the parameters dictionary again in nn_model. This involved using np.random to reinitialize the parameters dictionary, likely this was my problem. This would be affected by the np seed in nn_model. Using the initialize parameters function would have solved that problem.
Thanks for the input, this will help!
It is a mistake to manually rewrite the initialization in nn_model instead of just calling initialize_parameters. What is the point of writing subroutines if you don’t call them?
1 Like