Learning Curves & Validation Curves
Part of the Machine Learning Roadmap
In short
Your model isn't good enough. Should you collect more data, use a bigger model, or regularise harder? Learning curves and validation curves answer that question with two lines on a chart, before you spend weeks on the wrong fix.
A learning curve shows how training and validation scores change as you add more data, telling you whether more data would help. A validation curve shows how scores change as one hyperparameter changes, revealing the sweet spot.

Think of it like this
Training for the 5 km run
A coach tracks two numbers: how fast you run in practice and how fast you run in the real race. If both are slow, you need a better training plan, not more of the same (underfitting). If practice is great but the race is bad, you've only learned the practice track (overfitting). Watching both as training weeks increase tells you whether more weeks will help.
Watch it happen
Reading a learning curve
High bias (underfitting)
- Training and validation scores are both low.
- The two lines meet early and stay flat.
- More data won't help. Use a more flexible model or better features.
High variance (overfitting)
- Training score is high, validation score much lower.
- The gap narrows as data grows.
- More data, regularisation or a simpler model will help.
A learning curve tells you whether more data is worth collecting. A validation curve tells you where one hyperparameter's sweet spot is.
The big ideas
What you need to know
Learning curve: x = data size
Train on 10%, 20% ... 100% of the training data and plot training and validation scores at each size.
Validation curve: x = one setting
Vary one hyperparameter, like max_depth or C, and plot both scores to see where validation peaks.
The gap is variance
A big gap between training and validation means overfitting. Both low means underfitting.
Saves wasted effort
If the validation line has flattened, collecting another lakh rows won't help. Change the model instead.
See it in code
Walk through the code
1import matplotlib.pyplot as plt2import numpy as np3from sklearn.datasets import load_digits4from sklearn.model_selection import learning_curve, validation_curve5from sklearn.tree import DecisionTreeClassifier6 7X, y = load_digits(return_X_y=True)8tree = DecisionTreeClassifier(random_state=0)9 10sizes, train_sc, val_sc = learning_curve(11 tree, X, y, cv=5, train_sizes=np.linspace(0.1, 1.0, 8)12)13 14depths = np.arange(1, 21)15tr_d, val_d = validation_curve(16 tree, X, y, param_name="max_depth", param_range=depths, cv=517)18 19fig, ax = plt.subplots(1, 2, figsize=(11, 4))20ax[0].plot(sizes, train_sc.mean(axis=1), label="train")21ax[0].plot(sizes, val_sc.mean(axis=1), label="validation")22ax[0].set(xlabel="Training rows", ylabel="Accuracy", title="Learning curve")23ax[1].plot(depths, tr_d.mean(axis=1), label="train")24ax[1].plot(depths, val_d.mean(axis=1), label="validation")25ax[1].set(xlabel="max_depth", title="Validation curve")26ax[0].legend()27plt.show()1/4learning_curve retrains the tree on growing slices of data, scoring each with 5-fold cross-validation.
Both curves for a decision tree on the handwritten digits dataset.
Save yourself the pain
Common mistakes
Oops
Plotting only the validation line.
Do this instead
Always plot training and validation together. The gap between them is what diagnoses the problem.
Oops
Collecting more data when both scores are low and flat.
Do this instead
That's underfitting. More of the same data won't help. Add features or use a more powerful model.
Your mission
Diagnose three models
Quick check
Training accuracy is 99% and validation is 75%, and the gap shrinks as you add data. What should you try?
Go deeper
- 1Plot a learning curve with LearningCurveDisplay for a model you have trained.
- 2Plot a validation curve for max_depth with ValidationCurveDisplay.
- 3Decide from the curves whether to collect more data or change the model.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.