C2_W4_Decision_Tree_with_Markdown_Get best split

I could not able to resolve the error.


please help me to resolve.

Thank you

This is usually due to an error in your compute_entropy() function.

Update:
It’s also important to avoid using global variables inside the get_best_split() function.

I ran into this also. I realized upon reading the test code that it expects “-1” to be returned to tell the caller in case there is “no best split”. That occurs when the target (y) has all the same values, because there is no point in splitting the nodes across that feature anymore.