Lesson 6 of 11
Train, validation and test splits
In plain words: Split your data so you can check the model on examples it has never seen.
- Train (~70–80%): the model learns from this.
- Validation (~10–15%): you use this to compare models and tune settings.
- Test (~10–15%): touch it once, at the end, for an honest final score.
- If your data has dates, split by time so the test set is “the future”.
- Watch for data leakage: duplicates or features that secretly contain the answer.
Tip If your test score is suspiciously good, look for leakage before celebrating.
See it in a real project
- How to predict customer churn from your order history: features built as of a cutoff date
- How to detect fraudulent transactions: training on earlier transactions, testing on later ones
- How to sort customer reviews by sentiment: removing duplicate reviews before splitting
- How to predict house prices: cross-validation when there are only 1,460 sales
- How to route support tickets to the right team: testing on the latest two months of tickets
- How to forecast call volume and plan staffing: a week-by-week backtest over eight weeks
- How to forecast daily sales for each store: backtesting over several past dates
- How to find defective products in photos: keeping both photos of a part on the same side
- How to recommend products your customers will like: holding out the last month
- How to spot failing machines from sensor data: learning normal from two months, testing on a later one
- How to predict delivery times: learning from four months, choosing on May, testing on June
- How to predict customer lifetime value: learning from earlier signups, testing on the latest
- How to sort product photos into categories: keeping every photo of a product on the same side
- How to predict which employees might leave: learning from one year’s snapshot, testing on the next
- How to forecast inventory demand and set reorder points: learning on 2024, choosing safety stock on early 2025, testing on late 2025