NAN as results for the cost computations

I kept the model as it is, and curiously trained it. The results:

  1. The cost decreased faster than expected,
  2. Got the expected accuracy on the training set: 0.9999999999999998
  3. Higher accuracy on the test set than expected: expecting 0.72, but got 0.74

Maybe I can just keep it as it is and try to regularize in the next course to solve the obvious overfitting issue.

Any comments please?

Hi Bernard, I think you are missing something in your code. Is the activation for sigmoid and then activation for relu mentioned in your codes? I can’t assume, they are. And, in case, it is then re-run all the cells again through shift+enter as mentioned by Paul sir, above. Hope you will get it.

I think that means you used the “deep” version of the initialization routine for the two layer case. That is not incorrect from a philosophical point of view, but it will cause you to get different results. They use a more sophisticated version in the “deep” case. There are two separate init routines and you have to use the appropriate one.

Yes Rashmi, the activation functions are indeed mentioned in the code as you can see in the two lines of code I shared above. I really appreciate the assistance of Paul, many thanks for being around sir :slight_smile:

Was it the “init” function issue or are you still working on solving this?

Still working on it, the kernel just died :slight_smile: … It will take some time

Hello Paul, it was actually the ‘init’ function issue. As you rightly pointed out, I used the deep version to initialize the parameters. I changed it, and got the code working just fine. Many thanks for your assistance, well appreciated!

Okay, I see. Yes Paul sir and other mentors always help us in getting our problems duly solved.

I suggest that you rewrite the codes again for this cell completely. Erase the your present codes and try to rewrite it again after doing a restart with all the outputs cleared and saving your work.