8000 add **fit_params to sklearn.compose.ColumnTransformer().fit() · Issue #24490 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

add **fit_params to sklearn.compose.ColumnTransformer().fit() #24490

@cgahr

Description

@cgahr

Describe the workflow you want to enable

The fit function of both sklearn.pipeline.Pipeline and sklearn.pipeline.FeatureUnion supports **fit_params:

def fit(X, y=None, **fit_params):
    ...

Citing the documentation:

`**fit_params : dict of string -> object
Parameters passed to the fit method of each step, where each parameter name is prefixed such that parameter p for step s has key s__p.

Conversely, sklearn.compose.ColumnTransformer does not support fit_params:

def fit(X, y=None):
    ...

As far as I'm aware, it is therefore not possible to pass fit parameters to the individual column transforms.

Describe your proposed solution

The fit function of sklearn.compose.ColumnTransformer should support fit_params, using the same logic as sklearn.pipeline.Pipeline:

def fit(X, y=None, **fit_params):
    ...

Describe alternatives you've considered, if relevant

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0