Skip to content

[Bug]: AutoML(task="classification") is not detected as a classifier by scikit learns #1459

@lepennec

Description

@lepennec

Describe the bug

scikit learn has a is_classifier function that is used internally to detect whether the object is a classifier or not. It fails with AutoML(task="classifier"). More precisely, the __sklearn_tags__ method that is used in is_classifier returns a set of tags in which estimator_type ìs set to None, while getattr(AutoML(task="classifier"), "_estimator_type", None)|

I have stumbled on this issue while using a custom scorer which raises an error.

Finally, there is the same issue with the regression task which fails to be detected as a regressor by is_regressor

Steps to reproduce

from flaml import AutoML
from sklearn.base import is_classifier

is_classifier(AutoML(task="classifier")

AutoML(task="classifier").__sklearn_tags()

getattr(AutoML(task="classifier"), "_estimator_type", None)

Model Used

No response

Expected Behavior

AutoML(task="classifier") should be detected as a classifier.

Screenshots and logs

No response

Additional Information

FLAML Version : 2.3.6
Colab with Python 3.12.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions