Open bmreiniger opened 4 years ago
I'd give preference to _df_columns when available and in_names is None. Your solution is reasonable, though it uses a lot of private sklearn API. In Scikit-learn 0.23 you can use the n_featuresin attribute instead of the private equivalent, but the other private attributes there don't really have public equivalents.
I think it would be a good idea to contribute something like this to eli5... though we are working, very slowly, on trying to fix these limitations in Scikit-learn. It turns out to be a hard problem to solve.
From https://stackoverflow.com/q/60949339/10495893
If an sklearn
ColumnTransformer
has aPipeline
as one of its transformers, thentransform_feature_names
fails.I outlined one possible solution in an answer to the SO post. I'm not too happy with it since it basically copies and edits
ColumnTransformer.get_feature_names
and makes that the dispatch fortransform_feature_names
. I'm also not sure how to deal with conflictingin_names
and_df_columns
. An alternative, or suggested modifications?