Train-Test Split Ratios
What you'll learn: How to choose the right proportions when splitting your dataset into training and test sets.
The Classic Splits
When dividing data for machine learning, two ratios dominate practice: 70-30 (70% training, 30% testing) and 80-20 (80% training, 20% testing). These conventions emerged from balancing two competing needs: giving your model enough examples to learn from, while reserving sufficient data to reliably evaluate performance on unseen examples.
Think of it like studying for an exam. You need enough practice problems (training data) to master concepts, but you also need enough fresh problems (test data) to accurately gauge whether you truly understand the material or just memorized specific examples.
Choosing Based on Dataset Size
Large datasets (100,000+ examples): You can afford smaller test percentages like 90-10 or even 95-5. With thousands of test examples, your performance estimate remains statistically reliable. More training data typically improves model quality.
Medium datasets (1,000-100,000): Stick with the 80-20 or 70-30 standards. These provide reasonable training volume while maintaining test set reliability.
Small datasets (<1,000): Consider 60-40 or use k-fold cross-validation instead. With limited data, a tiny test set gives unreliable estimates, but starving the training set also hurts. Cross-validation helps squeeze maximum information from scarce data.
Problem-Specific Constraints
Adjust ratios based on:
- Class imbalance: Ensure rare classes appear sufficiently in both sets (use stratified sampling)
- Computational budget: Larger training sets take longer to train
- Temporal data: For time-series, you might reserve recent data as test (not random splits)
Key Takeaway: Choose 80-20 or 70-30 as defaults, but shift toward more training data when datasets are large and toward more test data (or cross-validation) when datasets are small—always ensuring your test set remains large enough for reliable evaluation.