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

ModuleNotFoundError: No module named 'sklearn.ensemble.forest' #50

Closed
ziadzee opened this issue Aug 18, 2021 · 3 comments
Closed

ModuleNotFoundError: No module named 'sklearn.ensemble.forest' #50

ziadzee opened this issue Aug 18, 2021 · 3 comments

Comments

@ziadzee
Copy link

ziadzee commented Aug 18, 2021

Hello, I am trying to import rfpimp however I am met by the error:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-133-c95d15dec9fe> in <module>
     24 import matplotlib.patheffects as PathEffects
     25 from pandas.plotting import lag_plot
---> 26 from rfpimp import *
     27 
     28 # Machine Learning libraries

~/opt/anaconda3/lib/python3.8/site-packages/rfpimp.py in <module>
     13 from sklearn.ensemble import RandomForestClassifier
     14 from sklearn.ensemble import RandomForestRegressor
---> 15 from sklearn.ensemble.forest import _generate_unsampled_indices
     16 from sklearn.ensemble import forest
     17 from sklearn.model_selection import cross_val_score

ModuleNotFoundError: No module named 'sklearn.ensemble.forest'

It seems that sklearn.ensemble.forest was renamed to sklearn.ensemble._forest (see here)

I'd have to install an older version for sklearn however that would break other dependencies I have. Is there a fix around this? Thanks

@parrt
Copy link
Owner

parrt commented Aug 18, 2021

Hmm...I thought we made latest version handle both. Are you using latest rfpimp?

@ziadzee
Copy link
Author

ziadzee commented Aug 18, 2021

Hi, @parrt - I have version: 1.3.2 installed. Unless I'm wrong, that's the latest build?

Name: rfpimp
Version: 1.3.2
Summary: Permutation and drop-column importance for scikit-learn random forests and other models
Home-page: https://github.com/parrt/random-forest-importances
Author: Terence Parr, Kerem Turgutlu
Author-email: parrt@antlr.org, kcturgutlu@dons.usfca.edu
License: MIT
Location: /Users/user/opt/anaconda3/lib/python3.8/site-packages
Requires: sklearn, matplotlib, numpy, pandas

@parrt
Copy link
Owner

parrt commented Aug 18, 2021

1.3.7 is the latest :)

@parrt parrt closed this as completed Aug 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants