Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

DOC: Fixes Docs for estimator types do not list all possible estimator types #29956

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

Merged
merged 6 commits into from
Oct 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions 13 doc/developers/develop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,16 @@ on a classifier, but not otherwise. Similarly, scorers for average precision
that take a continuous prediction need to call ``decision_function`` for classifiers,
but ``predict`` for regressors. This distinction between classifiers and regressors
is implemented using the ``_estimator_type`` attribute, which takes a string value.
It should be ``"classifier"`` for classifiers and ``"regressor"`` for
regressors and ``"clusterer"`` for clustering methods, to work as expected.
Inheriting from ``ClassifierMixin``, ``RegressorMixin`` or ``ClusterMixin``
This attribute should have the following values to work as expected:

- ``"classifier"`` for classifiers
- ``"regressor"`` for regressors
- ``"clusterer"`` for clustering methods
- ``"outlier_detector"`` for outlier detectors
- ``"DensityEstimator"`` for density estimators
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that this matches our current code base; however, I find the casing style of the last tag value inconsistent with the others. However, I don't see any easy way to fix it without breaking backward compat because it's technically part of our public API.

I guess we have to live with it for now but keep it in mind if we want to release scikit-learn 2.0 one day.

/cc @adrinjalali as developer API specialist.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in a rework of this document, I'd like to remove all of these and only document developing estimators via inheriting from our mixins. That would remove these parts anyway.

Otherwise. also gonna work on a PR to move this from the class attribute to a tag. I think it's doable, but need to actually implement it to be sure.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/cc @adrinjalali as developer API specialist.

I like the fancy title 😅


Inheriting from :class:`~base.ClassifierMixin`, :class:`~base.RegressorMixin`, :class:`~base.ClusterMixin`,
:class:`~base.OutlierMixin` or :class:`~base.DensityMixin`,
will set the attribute automatically. When a meta-estimator needs to distinguish
among estimator types, instead of checking ``_estimator_type`` directly, helpers
like :func:`base.is_classifier` should be used.
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.