While solving compute_information_gain(X, y, node_indices, feature)
Code seems to be working for basic case as shown but is failing to work for test cases.
Stuck here. Pls help
While solving compute_information_gain(X, y, node_indices, feature)
Code seems to be working for basic case as shown but is failing to work for test cases.
Stuck here. Pls help
Hello @Simardeep_Singh,
Please read this post on how we can locate the bug. It will take some time, because we need to verify each intermediate result ourselves, but the good thing is the test actually only used 5 samples, so it should be managable.
Cheers,
Raymond
Thanks. Was able to resolve error.
Hello @grajavelu,
Welcome to the community!
Assuming your compute_entropy
is correct because you need to use it, from the error message, your had over-estimated the gain, this means that you had underestimated the weighted_entropy
, and so the problems are likely in w_left
and w_right
. Ask yourself how you compute them now, then check the hints (underneath the exercise cell) as well as the exercise’s description, and find out what can go wrong.
Cheers,
Raymond
PS: I am closing this thread now because we should open new thread for new question. If you have any followup, please open a thread with the latest, full error traceback attached there.