project-template icon indicating copy to clipboard operation
project-template copied to clipboard

Add _OneToOneFeatureMixin to class templates

Open klapo opened this issue 2 years ago • 1 comments

Scikit-learn recently updated all classes to have the get_feature_names_out method in order to allow retrieving feature names from pipelines (https://github.com/scikit-learn/scikit-learn/issues/21308). The templates could be updated to reflect this new "template".

I believe it is just as simple as add _OneToOneFeatureMixin to each class. e.g.

from sklearn.base import BaseEstimator, ClassifierMixin, TransformerMixin, _OneToOneFeatureMixin

and

class TemplateEstimator(BaseEstimator, _OneToOneFeatureMixin):

What do you think?

klapo avatar Jul 08 '22 10:07 klapo

We could revisit a bit the documentation but I think that the details are already available in scikit-learn: https://scikit-learn.org/dev/developers/develop.html#developer-api-for-set-output

So we might improve the documentation to refer to that page.

glemaitre avatar May 01 '24 10:05 glemaitre