Machine learning isn't just calling fit — it's a repeatable workflow. Knowing the steps (and their order) keeps you from the classic mistakes, like testing on data you trained on.
The steps
- 1. Frame the problem — regression? classification? what's the target?
- 2. Get & split data — train/test split before anything else.
- 3. Explore & preprocess — clean, scale, encode (fit on train only).
- 4. Train — fit a model on the training set.
- 5. Evaluate — score on the held-out test set with the right metric.
- 6. Tune — cross-validate and search hyperparameters.
- 7. Deploy — persist the model and use it on new data.
The cardinal rule
Key takeaways
- 01ML is a workflow: frame → split → preprocess → train → evaluate → tune → deploy.
- 02Split into train/test before any preprocessing or exploration of the target.
- 03Fit transformations on training data only, then apply to test.
- 04Letting test data influence training is data leakage — it inflates scores and breaks in production.
