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

instantiating a ColumnTransformer with already fitted transformers #13614

Open
sebastiangonsal opened this issue Apr 10, 2019 · 6 comments
Open
Labels

Comments

@sebastiangonsal
Copy link

Can I instantiate a ColumnTransformer with already fitted transformers? I get an error right now saying the fit wasn't called on ColumnTransformer. I don't want to call fit on the transformer since I am using already fitted transformers and just want to use ColumnTransformer to aggregate the columns into a matrix.

@jnothman
Copy link
Member

jnothman commented Apr 11, 2019 via email

@thomasjpfan
Copy link
Member

Recently spoke to someone that is running into this issue. He fitted a transformer on unlabeled data and they he created a metaestimator to wrap this transformer in order to freeze it (by overwriting fit to do nothing). Next, he placed it into a ColumnTransformer as one of the transformers. Since ColumnTransformer will clone its transformers, the metaestimator that he wanted to freeze lost its trained state.

He also mentioned how this worked in Pipeline and that its weird it didn't work in ColumnTransformer. (No cloning in Pipeline)

@jnothman
Copy link
Member

jnothman commented Oct 26, 2019 via email

@ribonucleic
Copy link

I have another use case where I want to fit two target encoders not on the target label but on other labels (e.g. email domains we get many clicks from, whereas the final target is a user buying). So basically I have 3 y vectors. Fitting has to happen outside of column transformer, then the fitted transformers would be passed to column transformer.

Great hint about "clone"! Helps to find a workaround.

@jnothman
Copy link
Member

jnothman commented May 5, 2020

Why not pass categories to OneHotEncoder?

@sophieatalt
Copy link

was anyone able to find a solution to this?

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

No branches or pull requests

5 participants