Skip to content

RFC Move _more_tags to "developer API" via __sklearn_tags__ #28910

Closed
@adrinjalali

Description

@adrinjalali

As a part of making it easier and more "standard" to write scikit-learn estimators by third party developers, we have been slowly developing a "developer API" kind of thing, which are useful for third party developers, but not end users of the estimators.

Some of the work has been:

  • __sklearn_clone__
  • __metadata_request__fit, ...
  • get_metadata_routing

What I'm proposing here, is to create a new __sklearn__tags__ method instead of the existing _more_tags.

We've had a lot of discussions when we designed the current system, which goes through the MRO and the _more_tags adds to the tag set instead of returning the tags. Now the question is do we want to keep the current system or do we want __sklearn_tags__ to return the estimator's tags instead, and call parent's __sklearn_tags__ inside itself? As in, instead of:

class Estimator(BaseEstimator):
    ...
    def _more_tags(self):
        return {...}

to have:

class Estimator(BaseEstimator):
    ...
    def __sklearn_tags__(self):
        tags = super().__sklearn_tags__()
        # update tags
        return return tags

Inside our tags, we also have some starting with _ such as _xfail, and the question is do we want to make those public.

cc @scikit-learn/core-devs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions