@@ -104,19 +104,14 @@ class LinearBoostClassifier(AdaBoostClassifier):
104
104
- 'maxabs': Uses MaxAbsScaler.
105
105
- 'robust': Applies RobustScaler.
106
106
107
- class_weight : {"balanced", "balanced_subsample"}, dict or list of dicts, \
108
- default=None
107
+ class_weight : {"balanced"}, dict or list of dicts, default=None
109
108
Weights associated with classes in the form ``{class_label: weight}``.
110
109
If not given, all classes are supposed to have weight one.
111
110
112
111
The "balanced" mode uses the values of y to automatically adjust
113
112
weights inversely proportional to class frequencies in the input data
114
113
as ``n_samples / (n_classes * np.bincount(y))``
115
114
116
- The "balanced_subsample" mode is the same as "balanced" except that
117
- weights are computed based on the bootstrap sample for every tree
118
- grown.
119
-
120
115
Note that these weights will be multiplied with sample_weight (passed
121
116
through the fit method) if sample_weight is specified.
122
117
@@ -196,7 +191,7 @@ class LinearBoostClassifier(AdaBoostClassifier):
196
191
"algorithm" : [StrOptions ({"SAMME" , "SAMME.R" })],
197
192
"scaler" : [StrOptions ({s for s in _scalers })],
198
193
"class_weight" : [
199
- StrOptions ({"balanced_subsample" , " balanced" }),
194
+ StrOptions ({"balanced" }),
200
195
dict ,
201
196
list ,
202
197
None ,
@@ -307,15 +302,9 @@ def fit(self, X, y, sample_weight=None) -> Self:
307
302
self .n_classes_ = self .classes_ .shape [0 ]
308
303
309
304
if self .class_weight is not None :
310
- valid_presets = ("balanced" , "balanced_subsample" )
311
- if (
312
- isinstance (self .class_weight , str )
313
- and self .class_weight not in valid_presets
314
- ):
305
+ if isinstance (self .class_weight , str ) and self .class_weight != "balanced" :
315
306
raise ValueError (
316
- "Valid presets for class_weight include "
317
- '"balanced" and "balanced_subsample".'
318
- 'Given "%s".' % self .class_weight
307
+ f'Valid preset for class_weight is "balanced". Given "{ self .class_weight } ".'
319
308
)
320
309
expanded_class_weight = compute_sample_weight (self .class_weight , y )
321
310
0 commit comments