CLN GBDTs: don't split on last bin (explicitly)
@@ -432,7 +432,9 @@ cdef class Splitter:
negative_loss_current_node = negative_loss(sum_gradients,
sum_hessians, self.l2_regularization)
- for bin_idx in range(self.actual_n_bins[feature_idx]):
+ for bin_idx in range(self.actual_n_bins[feature_idx] - 1):
+ # Note that considering splitting on the last bin is useless since
+ # it would result in having 0 samples in the right node (forbidden)
n_samples_left += histograms[feature_idx, bin_idx].count
n_samples_right = n_samples_ - n_samples_left
