Train/test split, and why it is non-negotiable
After this lesson you can: Evaluate a model on data it has never seen.
First: Features and labels
Watch
- Machine Learning Fundamentals: Cross Validation - StatQuest with Josh Starmer, 6 min. Cross-validation reinforces the same principle: measure performance on data not used for fitting.
- A Gentle Introduction to Machine Learning - StatQuest with Josh Starmer, 13 min. A beginner-friendly overview can frame why evaluation matters, though it is broader than this lesson.
- Machine Learning Tutorial Python - 7: Training and Testing Data - codebasics, 7 min. Directly targets training versus testing data in Python, matching the lesson’s practical evaluation goal.
Notes
A model can look excellent simply because it has memorized the examples it was trained on. The train/test split prevents this self-deception: you train the model on one portion of the data, then evaluate it on a separate portion that was held back and never shown during training. The test set acts like a small rehearsal for production, where every input will be new.
Unlock the full lesson notes, the exercises and the graded checkpoint - ₹5,000 once.