Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

02 util: AttributeError: 'SelectFromModel' object has no attribute 'estimator_' #2

Open
kzfm opened this issue Feb 18, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@kzfm
Copy link
Member

kzfm commented Feb 18, 2019

feature_name[abs(selector_en.estimator.coef_)>selector_en.threshold_]

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-18-58d17a399d71> in <module>()
----> 1 feature_name[abs(selector_en.estimator.coef_)>selector_en.threshold_]

~/anaconda3/lib/python3.6/site-packages/sklearn/feature_selection/from_model.py in threshold_(self)
    172     @property
    173     def threshold_(self):
--> 174         scores = _get_feature_importances(self.estimator_, self.norm_order)
    175         return _calculate_threshold(self.estimator, scores, self.threshold)
    176 

AttributeError: 'SelectFromModel' object has no attribute 'estimator_'
@kzfm kzfm added the bug Something isn't working label Feb 18, 2019
@MNaumanBootter
Copy link

MNaumanBootter commented Jan 7, 2022

Sometimes, this kind of issue occurs because of scikit-learn's version mismatch. You may have to use the same version as of author's scikit-learn version.

I was having error: "AttributeError: 'SelectFromModel' object has no attribute 'importance_getter'".

I downgraded the scikit-learn from version 1.0.2 to 0.23.2 which was used to train the model and it fixed the issue.

Hope it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants