You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ColumnTransformer output unexpected prefixed feature names from FunctionTransformer() step #28260
The following code demonstrates that when FunctionTransformer is present as a step in ColumnTransformer, the feature names output are all prefixed with the name from the last step 'C__'. For example, column 'x1' is output as 'C__x1' for 3 times.
When 'FunctionTransferformer' is not present as a step, the feature names are corrected prefixed by the name in each steps. For example, column 'x1' is output as 'A__x1' and 'C__x1' respectively, as expected.
changed the title [-]ColumnTransFormer output unexpected prefixed feature names from FunctionTransformer() step[/-][+]ColumnTransformer output unexpected prefixed feature names from FunctionTransformer() step[/+]on Jan 25, 2024
Activity
[-]ColumnTransFormer output unexpected prefixed feature names from FunctionTransformer() step[/-][+]ColumnTransformer output unexpected prefixed feature names from FunctionTransformer() step[/+]glemaitre commentedon Jan 25, 2024
I can reproduce the issue. I'll investigate the reason.
glemaitre commentedon Jan 25, 2024
As a temporary workaround, setting
feature_names_out="one-to-one"provide the expected results.glemaitre commentedon Jan 25, 2024
We indeed refactor and use a dictionary to rename the columns: https://github.com/scikit-learn/scikit-learn/blob/main/sklearn/utils/_set_output.py#L125
But we overlooked that one could reuse the same column and then
x1get remapped to the latest transformer. We should therefore pass a list instead.glemaitre commentedon Jan 25, 2024
I'll submit a patch.
/take