Skip to content

Feature Engineering and Preprocessing

Feature Engineering and Preprocessing

Overview

Transform raw data into inputs a model can learn from.

Upstream context: perform basic EDA and solid Data Wrangling before heavy feature work; otherwise you may encode noise or leakage.

Techniques

  • Numeric: scaling/normalization
  • Categorical: one-hot encoding, embeddings
  • Text: bag-of-words, TF-IDF, tokenization
  • Images: resizing, normalization, augmentation

Example

  • Convert timestamps into hour-of-day and day-of-week

Checklist

  • Fit preprocessing on training set only
  • Save preprocessing steps to apply at inference
  • Document each transformation (why + reversible?)
  • Avoid leaking target info (see Model Evaluation & Metrics)

Resources

  • scikit-learn pipelines