C2_W4_Decision_Tree_with_Markdown Lab - Ex3. TypeError

Good Morning,
I have completed exercise 3 and checked my results with the hints but, although they are correct, I receive this error. Could you please help me?
Thank you,

Hi @Vittoria_Prunas ,

To find out what the problem might be, you can use print statement for debugging. I suggest you print out the value as well as the datatype of left_entropy to see what is going on.

Hi Kic, thank you very much for your quick reply. Where can I print the code?
I tried to re write it and now I have this Assertion error.

Hi @Vittoria_Prunas ,

The print statements should be in the code where compute_information_gain() is defined, between the comment lines:

start code here
end code here
Where your code is implemented.

For example, how do you obtain the left_entropy? If it is obtained by calling a function, then using the print statement will help to understand if the call to that function is successful or not by putting a print statement after the function call.

Thank you. Not sure about what you meant, but I tried to reprint the weighted entropy and note entropy and the first three values seem correct related to the expected gain, but then there are printed other additional 5 results. Could be this the problem? Really don’t understand how to solve it… :frowning:

Hi @Vittoria_Prunas ,

It seems your output matched the expected output, so I don’t understand fully what is going on here. Could you send me a direct message with the code for that function, compute_information_gain()

I think I sent you a message but not sure you received it!

Hi, yes, I got it. Will get back to you soon.