C2_W4_Decision_Tree_with_Markdown - error with #3 - reset multiple times

Hello,
I have tried to solve #3 several times and restarted my kernal and closed out and gone back but the error I am getting continues to be for things that were deleted from the cell. I can’t seem to get it to run properly. There is no P1 so why is it continuing to throw this error? Thanks

I don’t understand what you mean when you say “there is no p1”. You can see it in the code that is shown in the exception trace: it is in the logic of the compute_entropy function. It looks like it is getting assigned, but that line is indented, so maybe it is conditioned by an “if” clause and that if condition was false.

Notice that you called compute_entropy once before and it succeeded (or at least didn’t throw an exception). So why would it behave differently when you pass y_left as the argument? Something to investigate :nerd_face:

Note that I am not a mentor for MLS and have not worked that assignment, but everything I said above can be discerned simply by reading the exception trace you showed.

1 Like