Skip to content
Feb 27

Learning Curves for Model Diagnostics

MT
Mindli Team

AI-Generated Content

Learning Curves for Model Diagnostics

In machine learning, a model's performance on a tidy, held-out validation set is only a snapshot. It tells you how it's doing, but rarely why. To move from guesswork to precise diagnosis, you need to see how performance evolves. Learning curves provide this dynamic view, plotting a model's performance against the amount of training data it has seen. They are the essential diagnostic tool for distinguishing between a model that is too simple and one that is too complex, directly informing your most critical decision: should you collect more data, engineer better features, or adjust the model's complexity?

What Are Learning Curves?

A learning curve is a plot that shows the relationship between a machine learning model's performance and its experience, typically measured by the size of the training dataset. Crucially, we plot two curves simultaneously: one for the training score (e.g., error or accuracy) and one for the validation score (or test score). The training score measures how well the model fits the data it was trained on, while the validation score measures how well it generalizes to unseen data.

To generate these curves, you follow an incremental process. Start with a very small subset of your training data, fit your model, and record its score on that tiny training set and on the full, held-out validation set. Then, gradually increase the size of the training subset—for example, using 10%, 20%, 30%, up to 100% of the available training data—re-training and re-scoring the model at each step. The resulting plot reveals trends that are invisible in a single, final evaluation.

Diagnosing High Bias (Underfitting)

A model suffers from high bias when it is too simple to capture the underlying patterns in the data. It makes strong, incorrect assumptions about the data's structure, leading to underfitting. The learning curve signature for high bias is distinctive.

You will observe that both the training and validation performance curves converge to a low level of performance as more data is added. The key is that they converge at a low score. For a metric like accuracy, they plateau at a disappointingly low value; for error, they plateau at a high value. The curves are close together because a simple model cannot fit the training data well, so there is little gap between its performance on training and validation data. Adding more training data provides diminishing returns, as the model's fundamental simplicity prevents it from learning the necessary complexity from the additional examples.

Consider a real-world analogy: trying to fit a straight line (a linear model) to data that follows a sinusoidal wave. No matter how many data points from that wave you provide, a straight line will never fit well. The learning curves would show both training and validation error stabilizing at a high level. The clear diagnostic from this pattern is that the model itself is the problem—it lacks the necessary capacity.

Diagnosing High Variance (Overfitting)

High variance occurs when a model is excessively complex. It learns not only the underlying signal but also the noise in the training data, a problem known as overfitting. Its learning curve tells a very different story.

You will see a significant and persistent gap between the training score and the validation score. The training performance is often excellent (e.g., high accuracy, very low error), but the validation performance is markedly worse and may improve only very slowly with more data. The two curves diverge. The model fits the training data almost perfectly, but fails to generalize. A small gap is normal, but a large, enduring gap indicates high variance.

Using our earlier analogy, imagine fitting a high-degree polynomial to a few points from a straight line. The curve will pass perfectly through every training point (excellent training score) but will oscillate wildly elsewhere, performing poorly on new validation points. The learning curve would show near-perfect training error and a much higher, slowly improving validation error. The diagnosis here is that the model is memorizing rather than learning generalizable rules.

From Diagnosis to Actionable Insight

The true power of learning curves lies in translating diagnosis into a corrective strategy. The shape of the curves directly informs your next, most efficient step.

  • If you diagnose High Bias (Underfitting): Adding more training data will provide little to no benefit, as the curves have already converged at a poor performance level. Your action should be to increase model complexity or add better features. This means using a more powerful algorithm (e.g., moving from linear regression to polynomial regression or a decision tree), adding interaction terms or polynomial features, or reducing regularization strength.
  • If you diagnose High Variance (Overfitting): The learning curve shows the validation score still improving as more data is added. This indicates that more data is likely to help, as it gives the complex model more examples from which to learn the true signal and avoid latching onto noise. If more data is unavailable or insufficient, your alternative actions are to reduce model complexity (e.g., shallower trees, lower polynomial degree), increase regularization (e.g., higher lambda in Lasso/Ridge regression), or perform feature selection to reduce the number of inputs the model can use to overfit.

A well-tuned, ideal model will show learning curves where both training and validation performance converge to a high level of performance (low error) with a very small, stable gap between them. This indicates the model has sufficient capacity to learn the problem and generalizes effectively.

Common Pitfalls

  1. Misinterpreting a "Good" Training Score: A model achieving 99% accuracy on the training set is not a success; it is the primary warning sign of overfitting. Always compare it directly to the validation score on the learning curve. The validation score is the only metric that matters for generalization.
  1. Ignoring Data Quality and Leakage: Learning curves assume your validation set is pristine and representative. If your validation data is contaminated with information from the training set (data leakage) or is from a different distribution, the validation curve becomes meaningless, leading to incorrect diagnoses. Always ensure your data split is clean and your preprocessing (like scaling) is fit only on the training subset at each step of the learning curve.
  1. Stopping Too Early or Using Too Few Increments: Plotting learning curves with only 3 or 4 training set sizes can miss important trends, like a late convergence or a slowly narrowing gap. Use enough increments (commonly 10-20) to see a smooth trend. Conversely, ensure your smallest training subset is large enough for the model to learn anything meaningful at all.
  1. Fixing the Wrong Problem: Observing a large gap (variance) and responding by adding polynomial features (increasing complexity) will make the problem catastrophically worse. The learning curve pattern must guide the intervention: a gap means reduce complexity or add data; low convergence means increase complexity or improve features.

Summary

  • Learning curves plot model performance (training and validation scores) against increasing amounts of training data, providing a dynamic diagnostic tool beyond a single validation score.
  • High bias (underfitting) is diagnosed when both training and validation curves converge at a low level of performance. The solution is to increase model complexity or add more informative features, not more data.
  • High variance (overfitting) is diagnosed when a large gap persists between a high training score and a lower validation score. The primary solution is to gather more training data; secondary solutions include reducing model complexity or increasing regularization.
  • The ideal model shows both curves converging to a high level of performance with a minimal, stable gap between them.
  • Always generate learning curves with sufficient data increments and ensure your validation data is free from leakage to make accurate, actionable diagnoses.

Write better notes with AI

Mindli helps you capture, organize, and master any subject with AI-powered summaries and flashcards.