Skip to content

Commit 0c57afc

Browse files
author
maheshakya
committed
Moved __init__ to top. Test failure fixed?
1 parent 7dce20c commit 0c57afc

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

sklearn/feature_selection/from_model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ class SelectFromModel(BaseEstimator, _LearntSelectorMixin,
200200
The base estimator from which the transformer is built.
201201
"""
202202

203+
def __init__(self, estimator, threshold=None):
204+
self.estimator = estimator
205+
self.threshold = threshold
206+
203207
def _validate_estimator(self, default=None):
204208
"""Check the estimator and set the `estimator_` attribute."""
205209
if self.estimator is not None:
@@ -217,10 +221,6 @@ def _make_estimator(self):
217221

218222
return estimator
219223

220-
def __init__(self, estimator=None, threshold=None):
221-
self.estimator = estimator
222-
self.threshold = threshold
223-
224224
def _get_support_mask(self):
225225
return self.support_mask_
226226

sklearn/utils/testing.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,10 @@ def uninstall_mldata_mock():
439439
# Meta estimators need another estimator to be instantiated.
440440
meta_estimators = ["OneVsOneClassifier",
441441
"OutputCodeClassifier", "OneVsRestClassifier", "RFE",
442-
"RFECV", "BaseEnsemble", "SelectFromModel"]
442+
"RFECV", "BaseEnsemble"]
443443
# estimators that there is no way to default-construct sensibly
444-
other = ["Pipeline", "FeatureUnion", "GridSearchCV", "RandomizedSearchCV"]
444+
other = ["Pipeline", "FeatureUnion",
445+
"GridSearchCV", "RandomizedSearchCV", "SelectFromModel"]
445446

446447

447448
def all_estimators(include_meta_estimators=False, include_other=False,

0 commit comments

Comments
 (0)