Course 2 week 3 cost

Sir, I applied the previous method of code also but didn’t work with me.
Acctually I am getting a different error that isn’t mentioned in the previous threads or comments. I am adding the pics of screen so that you can more clearly understand my problem. And suggenst me the solution.


Well, where is new_y_train defined? Have you run that cell? Note that if you close and reopen the notebook or click any of the variations of “Kernel → Restart”, then you lose all the “runtime state” which includes the definitions of any variables created by any of the cells in the notebook. Or did that cell perhaps throw an error resulting in the variable not getting created? Try running it again and see what happens.

Also please read the instructions for that section again. In one of the recent updates to this notebook (maybe 3 weeks ago), they switching from BCE loss (binary cross entropy) to categorical cross entropy, because this is a multiclass classification.

Also note that you filed this under “General Discussion” and the title doesn’t really give any clue which specialization you are talking about. This Discourse instance now supports at least 5 different Specializations. Fortunately I recognized the variable names, so I moved it to DLS Course 2. You’ll have better luck getting your questions noticed if you create them in the relevant categories.

Sir I fixed the y_new_train. But Getting the new error on applying the below code for cost.

I fixed the error. Acctually i by mistake set the depth = 4 but now i correct it by setting it to 6

Great! Yes, this must have been a bug in your one hot logic that you hard-coded the depth. Glad to hear that you figured it out under your own power! But also note that the solution is not to hard-code it to 6, right? The solution is to use the parameter value that you are given, so that the code is “general” (works in all cases).