-
-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Base function to check if the model is a clusterer (analogous to base.is_classifier()
and base.is_regressor()
)?
#28960
Comments
It makes sense and in the same time I'm not sure if we want to move in that direction
|
I don't mind deprecating |
For the estimator types not so commonly used, one could imagine a more generic function like def is_estimator_type(estimator, expected_type: str):
return getattr(estimator, "_estimator_type", None) == expected_type in order to check for a given category. |
What we're planning to do would be more like: get_tags(estimator)["estimator_type"] == expected_type |
This fix allows fitting unsupervised estimators with the assumption that they will always predict to shape (n_samples,). Output dtype is now determined based on the `_estimator_type` attribute. This is likely a temporary solution as `_estimator_type` is planned for deprecation in favor of tags and explicit estimator type checking functions, but neither of those solutions are fully implemented yet. See scikit-learn/scikit-learn#28960
This fix allows fitting unsupervised estimators with the assumption that they will always predict to shape (n_samples,). Output dtype is now determined based on the `_estimator_type` attribute. This is likely a temporary solution as `_estimator_type` is planned for deprecation in favor of tags and explicit estimator type checking functions, but neither of those solutions are fully implemented yet. See scikit-learn/scikit-learn#28960
Discussed in #28904
Originally posted by aoot April 26, 2024
According to the note on figuring out the model type, it is recommended to use
sklearn.base.is_classifier()
orsklearn.base.is_regressor()
function to check instead of of checking the attribute_estimator_type
directly.However, since the attribute
_estimator_type
can be either"classifier"
,"regressor"
, and"clusterer"
, are there any base function such assklearn.base.is_clusterer()
to check if the model is a clusterer?Thanks for your input!
#28936 is an effort to fix this. Not sure what to think of it.
The text was updated successfully, but these errors were encountered: