[Bug]: AutoML(task="classification") is not detected as a classifier by scikit learns
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
Hi @lepennec , there is no task "classifier". Please use "classification" instead. https://microsoft.github.io/FLAML/docs/Use-Cases/Task-Oriented-AutoML
Thanks.
Btw, python 3.12 is not fully tested yet. Use python 3.11 or 3.10 if possible.
Sorry for the error in the code. I was using "classification" in my code, but I rewrote it with an error above. The issue is still here with
from flaml import AutoML
from sklearn.base import is_classifier
is_classifier(AutoML(task="classification")
AutoML(task="classification").__sklearn_tags()
getattr(AutoML(task="classification"), "_estimator_type", None)
Sorry for the error in the code. I was using "classification" in my code, but I rewrote it with an error above. The issue is still here with
from flaml import AutoML from sklearn.base import is_classifier is_classifier(AutoML(task="classification") AutoML(task="classification").__sklearn_tags() getattr(AutoML(task="classification"), "_estimator_type", None)
Thanks for the clarification, @lepennec .
There is no __sklearn_tags() because this was made public in scikit-learn 1.6.0, so FLAML didn't add this to the estimators. But it's a classifier.