I am getting an error about the probability p1 when I execute some cells whose I am unable to understand. The cell which involved the calculation of p1 worked without errors, so this should have worked as well. Please help.

The last test in `compute_information_gain_test()`

is to set the left indices to [ ]. So, this is the first case of` len(y) = 0`

. In your `compute_entropy()`

, there should be a consideration about this, but, most likely there is an error in indentation. Please check the case of len(y) = 0 in `compute_entropy()`

.