EasyDeepLearn

What does ColumnTransformer do and when do you need it?

easy

Answer

  • Applies different transformers to different subsets of columns in the same DataFrame and stitches the outputs back together into a single feature matrix.
  • Standard use: one-hot encode categoricals, standardize numerics, drop or passthrough others — all in one step, fit inside a Pipeline.
  • Combined with makecolumnselector\mathrm{make}_{\mathrm{column}}\mathrm{selector} you can select columns by dtype or name pattern instead of hard-coding indices.
  • The idiomatic way to handle mixed tabular data in scikit-learn.
Check yourself — multiple choice
  • It only works on numeric features
  • Applies different transformers to different column subsets; combines outputs into one matrix
  • It's a wrapper around KMeans
  • It replaces cross-validation

ColumnTransformer: apply different preprocessing per column subset; standard mixed-type handling.

#pipelines#preprocessing

Practise Supervised Learning

215 interview questions in this topic.

Related questions