Feature Engineering
Feature engineering is turning raw data into the inputs a model can actually learn from, by cleaning, transforming and combining it.
Machine Learning
Key takeaways
- Models see numbers, not meaning. Feature engineering supplies the meaning.
- On tabular data it usually matters more than which algorithm you pick.
- Fit transformations on training data only, or you leak test information into the model.
- A feature that would not exist at prediction time is leakage, however good the scores look.
Feature engineering is turning raw data into inputs a model can learn from. It covers cleaning, transforming, encoding and combining the columns you already have.
It matters because models see numbers, not meaning. A raw timestamp tells a model very little. Day of week and hour of day, pulled out of that same timestamp, can tell it a great deal.
Think of it like this. Think of prepping ingredients before cooking. The recipe assumes chopped onions. Handing over an unpeeled one is technically the same ingredient and produces a much worse dinner.
How it works
- Clean. Handle missing values, fix types, remove duplicates.
- Transform. Scale numbers to comparable ranges, take logs of skewed values.
- Encode. Turn categories into numbers the model can use.
- Derive. Pull day of week out of a date, or a ratio out of two columns.
- Select. Drop features that add noise rather than signal.
Common mistakes
- "Deep learning made this obsolete." It reduced it on images and text. On tabular data, engineered features remain the difference between a good model and a mediocre one.
- "More features is better." Irrelevant features add noise and make overfitting easier.
- "Fit the scaler on everything first." That leaks test data into training. Fit on the training set only, then apply.
- "Any column is fair game." A column that would not exist at prediction time will make your model look brilliant and useless.
Learn it on DevLoom
Read it free, then practice it with exercises.