Data Preparation for Machine Learning
Why clean data matters more than fancy models, and how to prepare it.
Inspired by learning material from Google
The quality of your data sets the ceiling on your model's performance. 'Garbage in, garbage out' is the iron law of ML.
Cleaning
- Handle missing values (fill, drop, or flag).
- Remove duplicates and obvious errors.
- Fix inconsistent formats and units.
Feature engineering
Create informative inputs: combine columns, extract dates, encode categories. Good features often beat fancier models.
Scaling and encoding
- Scale numeric features so large values don't dominate.
- Encode categories into numbers (one-hot or embeddings).
Splitting data
Split into training, validation, and test sets before exploring, to avoid leaking information.
Avoid data leakage
Never let information from the future or the test set sneak into training — it inflates results and fails in production.
Key takeaways
- Clean, well-engineered data beats fancy models.
- Scale and encode features appropriately.
- Guard against data leakage at all costs.