Skip to content

Add __sklearn_tags__ method to all transformers to be compatible with sklearn pipeline #831

Description

@Morgan-Sell

Describe the bug
In scikit-learn v1.7, all transformers/estimators, used in a pipeline, must have a __sklearn_tags__ method.

__sklearn_tags__ is used to provide metadata about the estimator, such as whether it supports multi-output, requires fitted parameters, etc.

For more information, go to this page of the scikit-learndocs and search for "sklearn_tags". It's located under the "Estimator Tags" section.

To Reproduce
Use any feature-engine transformer in a sklean pipeline.

Expected behavior
Proper execution of sklearn pipeline that uses feature-engine transformers.

Screenshots
Here's the warning that's raised:

 FutureWarning: The CategoricalImputer or classes from which it inherits use `_get_tags` and `_more_tags`. Please define the `__sklearn_tags__` method, or inherit from `sklearn.base.BaseEstimator` and/or other appropriate mixins such as `sklearn.base.TransformerMixin`, `sklearn.base.ClassifierMixin`, `sklearn.base.RegressorMixin`, and `sklearn.base.OutlierMixin`. From scikit-learn 1.7, not defining `__sklearn_tags__` will raise an error.

Desktop (please complete the following information):

  • OS: Mac
  • Browser: Chrome
  • Version: Latest feature-engine version

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions