File tree Expand file tree Collapse file tree 3 files changed +16
-8
lines changed Expand file tree Collapse file tree 3 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -69,15 +69,18 @@ Changelog
69
69
:mod: `sklearn.ensemble `
70
70
.......................
71
71
72
+ - |Feature | :class: `ensemble.HistGradientBoostingClassifier ` and
73
+ :class: `ensemble.HistGradientBoostingRegressor ` have an additional
74
+ parameter called `warm_start ` that enables warm starting. :pr: `14012 ` by
75
+ :user: `Johann Faouzi <johannfaouzi> `.
76
+
72
77
- |Fix | :class: `ensemble.HistGradientBoostingClassifier ` and
73
78
:class: `ensemble.HistGradientBoostingRegressor ` now bin the training and
74
79
validation data separately to avoid any data leak. :pr: `13933 ` by
75
80
`Nicolas Hug `_.
76
81
77
- - |Feature | :class: `ensemble.HistGradientBoostingClassifier ` and
78
- :class: `ensemble.HistGradientBoostingRegressor ` have an additional
79
- parameter called `warm_start ` that enables warm starting. :pr: `14012 ` by
80
- :user: `Johann Faouzi <johannfaouzi> `.
82
+ - |Fix | :func: `ensemble.VotingClassifier.predict_proba ` will no longer be
83
+ present when `voting='hard' `. :pr: `14287 ` by `Thomas Fan `_.
81
84
82
85
- |Enhancement | :class: `ensemble.HistGradientBoostingClassifier ` the training
83
86
loss or score is now monitored on a class-wise stratified subsample to
Original file line number Diff line number Diff line change @@ -68,7 +68,12 @@ def test_predictproba_hardvoting():
68
68
('lr2' , LogisticRegression ())],
69
69
voting = 'hard' )
70
70
msg = "predict_proba is not available when voting='hard'"
71
- assert_raise_message (AttributeError , msg , eclf .predict_proba , X )
71
+ with pytest .raises (AttributeError , match = msg ):
72
+ eclf .predict_proba
73
+
74
+ assert not hasattr (eclf , "predict_proba" )
75
+ eclf .fit (X , y )
76
+ assert not hasattr (eclf , "predict_proba" )
72
77
73
78
74
79
def test_notfitted ():
Original file line number Diff line number Diff line change @@ -313,9 +313,6 @@ def _collect_probas(self, X):
313
313
314
314
def _predict_proba (self , X ):
315
315
"""Predict class probabilities for X in 'soft' voting """
316
- if self .voting == 'hard' :
317
- raise AttributeError ("predict_proba is not available when"
318
- " voting=%r" % self .voting )
319
316
check_is_fitted (self , 'estimators_' )
320
317
avg = np .average (self ._collect_probas (X ), axis = 0 ,
321
318
weights = self ._weights_not_none )
@@ -335,6 +332,9 @@ def predict_proba(self):
335
332
avg : array-like, shape (n_samples, n_classes)
336
333
Weighted average probability for each class per sample.
337
334
"""
335
+ if self .voting == 'hard' :
336
+ raise AttributeError ("predict_proba is not available when"
337
+ " voting=%r" % self .voting )
338
338
return self ._predict_proba
339
339
340
340
def transform (self , X ):
You can’t perform that action at this time.
0 commit comments