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' #11

Open
JaimeArboleda opened this issue Dec 9, 2022 · 0 comments
Open

Comments

@JaimeArboleda
Copy link

JaimeArboleda commented Dec 9, 2022

Hello,

I tried running suod with the following code:

import pandas as pd, numpy as np
from pyod.models.ecod import ECOD
from pyod.models.suod import SUOD
from pyod.models.lof import LOF
from pyod.models.iforest import IForest
from pyod.models.copod import COPOD
from pyod.models.kpca import KPCA
from pyod.utils.utility import standardizer

prepared_np = standardizer(prepared_df)

# train SUOD
clf_name = 'ensemble'

# initialized a group of outlier detectors for acceleration
detector_list = [
    LOF(n_neighbors=20),
    ECOD,
    COPOD(), 
    IForest(n_estimators=200),
    KPCA()
]

# decide the number of parallel process, and the combination method
clf = SUOD(
    base_estimators=detector_list, 
    n_jobs=-1, 
    combination='average',
    verbose=True
)
clf.fit(prepared_np)

And I got this error:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-3-f2fb948dc9a9> in <module>
      1 print('Training...')
      2 
----> 3 clf.fit(prepared_np)
      4 
      5 scores = clf.decision_scores_  # raw outlier scores

/app/dataiku/design/code-envs/python/SP3/lib/python3.6/site-packages/pyod/models/suod.py in fit(self, X, y)
    208 
    209         # fit the model and then approximate it
--> 210         self.model_.fit(X)
    211         self.model_.approximate(X)
    212 

/app/dataiku/design/code-envs/python/SP3/lib/python3.6/site-packages/suod/models/base.py in fit(self, X)
    265         if self.bps_flag:
    266             # load the pre-trained cost predictor to forecast the train cost
--> 267             cost_predictor = joblib.load(self.cost_forecast_loc_fit_)
    268 
    269             time_cost_pred = cost_forecast_meta(cost_predictor, X,

/app/dataiku/design/code-envs/python/SP3/lib/python3.6/site-packages/joblib/numpy_pickle.py in load(filename, mmap_mode)
    585                     return load_compatibility(fobj)
    586 
--> 587                 obj = _unpickle(fobj, filename, mmap_mode)
    588     return obj

/app/dataiku/design/code-envs/python/SP3/lib/python3.6/site-packages/joblib/numpy_pickle.py in _unpickle(fobj, filename, mmap_mode)
    504     obj = None
    505     try:
--> 506         obj = unpickler.load()
    507         if unpickler.compat_mode:
    508             warnings.warn("The file '%s' has been generated with a "

/usr/lib64/python3.6/pickle.py in load(self)
   1048                     raise EOFError
   1049                 assert isinstance(key, bytes_types)
-> 1050                 dispatch[key[0]](self)
   1051         except _Stop as stopinst:
   1052             return stopinst.value

/usr/lib64/python3.6/pickle.py in load_global(self)
   1336         module = self.readline()[:-1].decode("utf-8")
   1337         name = self.readline()[:-1].decode("utf-8")
-> 1338         klass = self.find_class(module, name)
   1339         self.append(klass)
   1340     dispatch[GLOBAL[0]] = load_global

/usr/lib64/python3.6/pickle.py in find_class(self, module, name)
   1386             elif module in _compat_pickle.IMPORT_MAPPING:
   1387                 module = _compat_pickle.IMPORT_MAPPING[module]
-> 1388         __import__(module, level=0)
   1389         if self.proto >= 4:
   1390             return _getattribute(sys.modules[module], name)[0]

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

I am using the following versions:

combo==0.1.3
joblib==1.1.1
multiprocess==0.70.12.2
numba==0.53.1
numpy==1.19.5
pandas==1.0.5
pyod==1.0.6
scikit-learn==0.20.4
scipy==1.5.4
statsmodels==0.10.2
suod==0.0.7

Well, my env has more libraries, but I left only the ones that I think might be relevant for the issue.

I would be grateful for any help.

And thanks a lot for your wonderful work!

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

1 participant