Skip to content

Commit 6f335af

Browse files
committed
fix issue 4447 : min_weight_leaf not properly passed to PresortBestSplitter
1 parent cbd7537 commit 6f335af

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

sklearn/ensemble/gradient_boosting.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,12 +1002,19 @@ def _fit_stages(self, X, y, y_pred, sample_weight, random_state,
10021002
n_inbag = max(1, int(self.subsample * n_samples))
10031003
loss_ = self.loss_
10041004

1005+
# Set min_weight_leaf from min_weight_fraction_leaf
1006+
if self.min_weight_fraction_leaf != 0. and sample_weight is not None:
1007+
min_weight_leaf = (self.min_weight_fraction_leaf *
1008+
np.sum(sample_weight))
1009+
else:
1010+
min_weight_leaf = 0.
1011+
10051012
# init criterion and splitter
10061013
criterion = FriedmanMSE(1)
10071014
splitter = PresortBestSplitter(criterion,
10081015
self.max_features_,
10091016
self.min_samples_leaf,
1010-
self.min_weight_fraction_leaf,
1017+
min_weight_leaf,
10111018
random_state)
10121019

10131020
if self.verbose:

0 commit comments

Comments
 (0)