Course 2 Programming Assignment: Decision Trees-Exercise 4

I got the best feature to split correctly, but the test function is getting IndexError “index 5 out of bound for axis 0 with size 5”.

Please help.

In your split_dataset() function, I suspect that either ‘i’ or ‘feature’ has an invalid value.

Thank you for your response. But, the split function passed all the previous exercises. Is it possible that there is an issue with the test function?

The tests in the notebook are not comprehensive, and do not prove your code is perfect.

It is unlikely you’ve discovered a problem in the test function, since it has been used some time with no issues reported.

You are right.
I found the error in this statement:
info_gain = {moderator edit: code removed}
While the correct one is:
info_gain = {moderator edit: code removed}
I appreciate your help!