Skip to content
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

[FEATURE] Enable GroupedTransformer to work with .set_output(transform="pandas") #696

Closed
olivier-s-j opened this issue Aug 16, 2024 · 1 comment · Fixed by #697
Closed
Labels
enhancement New feature or request

Comments

@olivier-s-j
Copy link

In Scikit-learn the set_output API was recently introduced: https://scikit-learn.org/stable/auto_examples/miscellaneous/plot_set_output.html

However, unless I am mistaken, Scikit-lego is not yet compatible with this. It would be nice to have this compatibility.

I came across this incompatibility when creating:

ColumnTransformer(
            transformers=[
                (
                    "cat",
                    OrdinalEncoder(
                        handle_unknown="use_encoded_value", unknown_value=-1
                    ),
                    categorical_features,
                ),
                (
                    "cont",
                    GroupedTransformer(
                        StandardScaler(), groups=["GROEP_A", "GROEP_B"]
                    ),
                    continuous_features
                ),
            ],
            verbose_feature_names_out=False,
        ).set_output(transform="pandas")

Which results in:

ValueError: Unable to configure output for GroupedTransformer(groups=['GROEP_A', 'GROEP_B'],
                   transformer=StandardScaler()) because `set_output` is not available.
@olivier-s-j olivier-s-j added the enhancement New feature or request label Aug 16, 2024
@FBruzzesi
Copy link
Collaborator

Hey there! Thanks for reporting this issue. This should certainly be possible and it should be enough to implement get_feature_names_out (as explained in the official doc section).

@olivier-s-j please let us know if you would be interested in opening a PR tackling GroupedTransformer.

@koaning this could be a nice addition and a quick win for most transformers honestly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants