Error in EX4 when using different code

hi, in EX4, i used code which is different with the answers and it shows error like this?
can anyone help me with than~ QAQ thx a lot!
{ code removed by mentor}

Hello @Xie_Jinglin,

Please check out the hint underneath the exercise first, because that will give you a skeleton to start with. The logic is that we check the gain of every possible splits and only remember the one that has the maximum gain.


1 Like

Hi @Xie_Jinglin

In addition to what rmwkwok said In function get_best_split you first start with variable max_info_gain and you give it small value like 0 and after that you doing loop over features do you have to choose the best best_feature that make best split ,so every iteration you call fun compute_information_gain and put the value in variable info_gain and check(if condition) if value of the variable info_gain is greater then max_info_gain if yes you update two variables max_info_gain with info_gain and best_feature with iterative feature


1 Like