@@ -76,7 +76,7 @@ class SelectFromModel(MetaEstimatorMixin, SelectorMixin, BaseEstimator):
76
76
``feature_importances_`` or ``coef_`` attribute after fitting.
77
77
Otherwise, the ``importance_getter`` parameter should be used.
78
78
79
- threshold : string or float, default=None
79
+ threshold : str or float, default=None
80
80
The threshold value to use for feature selection. Features whose
81
81
importance is greater or equal are kept while the others are
82
82
discarded. If "median" (resp. "mean"), then the ``threshold`` value is
@@ -144,6 +144,14 @@ class SelectFromModel(MetaEstimatorMixin, SelectorMixin, BaseEstimator):
144
144
threshold_ : float
145
145
The threshold value used for feature selection.
146
146
147
+ See Also
148
+ --------
149
+ RFE : Recursive feature elimination based on importance weights.
150
+ RFECV : Recursive feature elimination with built-in cross-validated
151
+ selection of the best number of features.
152
+ SequentialFeatureSelector : Sequential cross-validation based feature
153
+ selection. Does not rely on importance weights.
154
+
147
155
Notes
148
156
-----
149
157
Allows NaN/Inf in the input if the underlying estimator does as well.
@@ -169,14 +177,6 @@ class SelectFromModel(MetaEstimatorMixin, SelectorMixin, BaseEstimator):
169
177
[-0.02],
170
178
[-0.48],
171
179
[ 1.48]])
172
-
173
- See Also
174
- --------
175
- RFE : Recursive feature elimination based on importance weights.
176
- RFECV : Recursive feature elimination with built-in cross-validated
177
- selection of the best number of features.
178
- SequentialFeatureSelector : Sequential cross-validation based feature
179
- selection. Does not rely on importance weights.
180
180
"""
181
181
182
182
def __init__ (
@@ -238,11 +238,13 @@ def fit(self, X, y=None, **fit_params):
238
238
The target values (integers that correspond to classes in
239
239
classification, real numbers in regression).
240
240
241
- **fit_params : Other estimator specific parameters
241
+ **fit_params : dict
242
+ Other estimator specific parameters.
242
243
243
244
Returns
244
245
-------
245
246
self : object
247
+ Fitted estimator.
246
248
"""
247
249
if self .max_features is not None :
248
250
if not isinstance (self .max_features , numbers .Integral ):
@@ -269,6 +271,7 @@ def fit(self, X, y=None, **fit_params):
269
271
270
272
@property
271
273
def threshold_ (self ):
274
+ """Threshold value used for feature selection."""
272
275
scores = _get_feature_importances (
273
276
estimator = self .estimator_ ,
274
277
getter = self .importance_getter ,
@@ -290,11 +293,13 @@ def partial_fit(self, X, y=None, **fit_params):
290
293
The target values (integers that correspond to classes in
291
294
classification, real numbers in regression).
292
295
293
- **fit_params : Other estimator specific parameters
296
+ **fit_params : dict
297
+ Other estimator specific parameters.
294
298
295
299
Returns
296
300
-------
297
301
self : object
302
+ Fitted estimator.
298
303
"""
299
304
if self .prefit :
300
305
raise NotFittedError ("Since 'prefit=True', call transform directly" )
@@ -305,6 +310,7 @@ def partial_fit(self, X, y=None, **fit_params):
305
310
306
311
@property
307
312
def n_features_in_ (self ):
313
+ """Number of features seen during `fit`."""
308
314
# For consistency with other estimators we raise a AttributeError so
309
315
# that hasattr() fails if the estimator isn't fitted.
310
316
try :
0 commit comments