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

Error: Algorithm should either be a classifier to be used with response_method=predict_proba or the response_method should be 'predict' #638

Closed
yiannis-gkoufas opened this issue Jul 16, 2023 · 4 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@yiannis-gkoufas
Copy link

Hi!

Recently I started getting this error (or warning?) with binary classification.
Minimal code to reproduce the problem:

from supervised import AutoML

if __name__ == '__main__':
    from sklearn.datasets import make_classification
    X, y = make_classification(n_samples=100000, n_features=20, n_redundant=2)
    from sklearn.model_selection import train_test_split
    X_train, X_test, y_train, y_test = train_test_split( X, y, test_size=0.3)
    automl = AutoML(eval_metric="accuracy")
    automl.fit(X_train, y_train)
    automl.report()

I get multiple messages:

DecisionTreeAlgorithm should either be a classifier to be used with response_method=predict_proba or the response_method should be 'predict'. Got a regressor with response_method=predict_proba instead.
Problem during computing permutation importance. Skipping ...

Is it a new bug or we can just ignore it?
Thank you!

@pplonski
Copy link
Contributor

Hi @yiannis-gkoufas,

Thank you for reporting the issue and thanks for code to reproduce the issue. I need to look closer into it. Hard to say is it bug or can be ignored. Any help will be appreciated :)

@pplonski pplonski added help wanted Extra attention is needed good first issue Good for newcomers labels Jul 17, 2023
@yiannis-gkoufas
Copy link
Author

Sounds like an update of sklearn might have caused it?

@williamty
Copy link

i met this error too. it will appear for DecisionTreeAlgorithm/LightgbmAlgorithm/XgbAlgorithm/RandomForestAlgorithm/ExtraTreesAlgorithm, all of which are tree based algorithm. i have set explain_level to 2. i'm not sure if the error is affected by the explain level.

@pplonski
Copy link
Contributor

I'm not sleeping - fixing ... Looks like after sklearn update the warning started to popup. To fix it I've added ClassifierMixin or RegressorMixin from sklearn.base for each algorithm.

I've seen few more warnings, I would like to fix them and then release a new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants