Pipeline with ColumnTransformer versus Standalone ColumnTransformer for Repeatable Mixed-Type Preprocessing
20.5K reputation · 05 Sept 2022, 06:51 UTC
Goal: ensure repeatable preprocessing pipeline that handles numeric and categorical features while preserving ability to inspect feature importance after training. Constraint: need to avoid data leakage during cross-validation and maintain consistent transformation across folds. Uncertainty: whether embedding ColumnTransformer inside a Pipeline offers any advantage over using ColumnTransformer directly with an estimator, especially regarding the remainder parameter and column name retention.
Questions: Does wrapping ColumnTransformer in a Pipeline change how the remainder parameter treats unmentioned columns? Does the Pipeline approach retain original column names after transformation for downstream interpretation? Is there any difference in cross‑validation leakage risk between the two constructions?