I am nearly at the end of the course and can not determine why this error occurs.
Your get_best_split() function is using incorrect indexing.
Please don’t post your code on the forum.
I don’t see any issues there.
Maybe the problem is in compute_information_gain().
Note: x_train does not exist inside the context of compute_information_gain(). There is an ‘X’ variable, but no x_train.