Train/Validation/Test Split
Machine Learning · Beginner
Definition
Data is split into training (learn), validation (tune) and test (final evaluation) sets.
Prevents fooling yourself with scores on data the model has seen.
Diagram
Flowchart
Example: Simple split
data = list(range(10))
n = int(len(data) * 0.8)
print(len(data[:n]), len(data[n:]))Output: 8 2
Key points
- Never tune on the test set
- Stratify for imbalanced classes
Interview questions
What is data leakage?
When information from the test set leaks into training, inflating scores.