Git Product home page Git Product logo

Comments (6)

am-official avatar am-official commented on July 28, 2024 2

Those who are facing ModuleNotFoundError: No module named 'sklearn.utils.testing'

import sklearn
estimators = sklearn.utils.all_estimators(type_filter=None)
for name, class_ in estimators:
    if hasattr(class_, 'predict_proba'):
        print(name)

from lazypredict.

adarshchbs avatar adarshchbs commented on July 28, 2024

Change the sklearn version to 23.x instead of 24.x.

from lazypredict.

WOKNz avatar WOKNz commented on July 28, 2024

from sklearn.utils.testing import all_estimators to
from sklearn.testing import all_estimators

from lazypredict.

sanromd avatar sanromd commented on July 28, 2024

I came across the same problem that @Rushi21-kesh mentioned. The ModuleNotFoundError arises when removing classifiers and regressors. I solved the issue by modifying the firs couple of lines in Supervised.py. @shankarpandala Instead of building a list of tupples (estimator_name, sklearn.moduleX) to remove, create a list with estimator_name to remove, then use it in the list comprehension to remove them. This effectively makes the code run with sklearn 0.23.x and 0.24.x

removed_classifiers = [
    "ClassifierChain",
    "ComplementNB",
    "GradientBoostingClassifier",
    "GaussianProcessClassifier",
    "HistGradientBoostingClassifier",
    "MLPClassifier",
    "LogisticRegressionCV", 
    "MultiOutputClassifier", 
    "MultinomialNB", 
    "OneVsOneClassifier",
    "OneVsRestClassifier",
    "OutputCodeClassifier",
    "RadiusNeighborsClassifier",
    "VotingClassifier",
]

removed_regressors = [
    "TheilSenRegressor",
    "ARDRegression", 
    "CCA", 
    "IsotonicRegression", 
    "StackingRegressor",
    "MultiOutputRegressor", 
    "MultiTaskElasticNet", 
    "MultiTaskElasticNetCV", 
    "MultiTaskLasso", 
    "MultiTaskLassoCV", 
    "PLSCanonical", 
    "PLSRegression", 
    "RadiusNeighborsRegressor", 
    "RegressorChain", 
    "VotingRegressor", 
]
CLASSIFIERS = [est for est in all_estimators() if 
               (issubclass(est[1], ClassifierMixin) and (est[0] not in removed_classifiers))]

REGRESSORS = [est for est in all_estimators() if 
              (issubclass(est[1], RegressorMixin) and (est[0] not in removed_regressors))]

from lazypredict.

Josephsmurph13 avatar Josephsmurph13 commented on July 28, 2024

Apologies, I am very new to python. I am getting the same error ModuleNotFoundError: No module named 'sklearn.utils.testing'.

Is this issue likely to be fixed in a new version soon? I am unable to install previous versions of lazypredict.

Do we know if editing the Supervised.py under the lazypredict site-packages folder fixes this? If so please could someone share the full contents of the file to update?

from lazypredict.

naveen-marthala avatar naveen-marthala commented on July 28, 2024

I have the same error and I am using sklearn 0.24.x.

user@name::~$ pip freeze | grep -i 'learn'
imbalanced-learn==0.7.0
scikit-learn==0.24.2
sklearn==0.0
umap-learn==0.5.1
user@name::~$ pip freeze | grep -i 'lazy'
lazypredict==0.2.9

from lazypredict.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.