Concepts / Model evaluation on unseen data

Model evaluation on unseen data

Underfitting does not simply mean that a model performs poorly for no reason. It means the model has not yet represented all the relevant patterns in its training data, so further useful progress is still available.

  • Programming

Why Familiar Success Can Mislead

A model can appear to improve while it is learning less useful behavior. Its performance on the data used for training may continue to get better, yet its performance on data it has not seen may stop improving or begin to decline. This is the central difficulty behind overfitting: success on familiar examples is not the same as reliable performance on new examples.

Definition

Optimization measures how well the model is improving on the training data. Generalization measures how reliably that learned behavior works on data the model has not seen.

Training dataFamiliar examplesOptimizationPerformance improvesUnseen dataNew examplesGeneralizationMay stall or declineimproves onreveals performance on
How can training performance improve while performance on unseen data gets worse?

Three Stages of Training

Training performance and validation performance often move together at first. Reducing the model's loss on training examples is commonly accompanied by lower loss on unseen examples. This early agreement is useful, but it does not continue indefinitely.

UnderfittingBoth can improveStrong validationBest observed pointOverfittingTraining improves;validation worsenstraining continuestraining continues
What changes in training and validation performance as a model moves through training?
Worked example

Following a topic-classification model

A model is trained to classify topics. What do three observations during training tell us?

  1. 1
    Beginning

    The model has not captured all the relevant patterns in the training data. It is underfit, so useful progress is still available.

  2. 2
    Middle

    Training performance improves and validation performance also improves. The model is learning behavior that is useful beyond the familiar training examples.

  3. 3
    Later

    Training performance continues to improve, but validation metrics stop improving and then worsen. Optimization is continuing, while generalization is no longer getting better.

Result

The model has moved from underfitting toward overfitting. The strongest validation performance occurred before the later training progress on the training set.

Key point

Underfitting does not simply mean that a model performs poorly for no reason. It means the model has not yet represented all the relevant patterns in its training data, so further useful progress is still available.

Reading Validation Performance

Validation performance helps reveal when continued training has stopped improving generalization. The training result tells you how the model is doing on examples it has used. The validation result gives a separate view of how dependable the learned behavior is on examples it has not seen.

Available examplesTraining dataUsed during trainingModelLearns from training dataValidation dataKept unseen during trainingValidationperformanceEvidence aboutgeneralizationassigned for learningheld out for evaluationtrainsevaluatesproduces
How does data move from training to evaluation, and why must evaluation data remain unseen during training?

The key comparison is not whether training performance is improving in isolation. Ask whether validation performance is improving as well. If both improve, the model may still be learning useful patterns. If training performance improves while validation performance stalls or declines, the model is becoming increasingly tailored to its training set.

Useful Patterns and Memorized Details

A useful pattern captures information that helps the model perform on new examples. A training-specific pattern belongs to the particular training data and does not provide reliable guidance outside it. Overfitting begins when the model starts learning details that may be misleading or irrelevant beyond the training set.

Relevant patternUseful on new examplesNew examplesReliable guidanceTraining-specificdetailMisleading outside trainingdataUnreliable resultDoes not transfer reliablytransfers tofails to guide
Which patterns learned from training data remain useful on new examples, and which are merely specific to the training set?
In the real world

In movie-review prediction, topic classification, or house-price regression, a model may learn patterns that are genuinely useful across examples. It may also learn details specific to the training data that do not help with new reviews, new documents, or new houses. The task changes, but the basic overfitting issue remains the same.

The distinction cannot be decided from training performance alone. A training-specific pattern can make the model look more successful on familiar examples even while making its behavior less dependable on unseen data. Validation performance is therefore evidence about whether learned behavior transfers.

Reducing Overfitting

The strongest general remedy for overfitting is to obtain more training data. More examples give the model more information from which to learn and make it more likely to develop patterns that generalize.

When obtaining more data is not possible, the next approaches change how much information the model can store or place constraints on the information it is allowed to store. Limiting what the model can retain makes unrestricted memorization less available. The optimization process is then pushed toward the most prominent patterns, which have a better chance of generalizing.

More training dataMore examples to learn fromMore reliablepatternsBetter chance of transferLimit retainedinformationLess unrestrictedmemorizationMonitor validationNotice when generalizationstallssupports learningpushes optimization towardhelps identify
How do more data, limits on retained information, and validation-guided training change the tendency to overfit?
  • Compare training performance with validation performance rather than relying on training performance alone.
  • Treat continued training as useful only while validation performance is also improving.
  • Prefer more training data when it can be obtained.
  • When more data is unavailable, limit how much information the model can retain so unrestricted memorization is less available.

Mistakes to Avoid

  • Common mistake

    Assuming that better training performance always means a better model

    What it looks like

    Training performance continues to improve while validation metrics have already begun to worsen.

    Why it fails

    Optimization is continuing, but generalization is declining.

    Do this instead

    Check whether validation performance improves alongside training performance.

  • Common mistake

    Calling every poorly performing model overfit

    What it looks like

    A model has not captured all the relevant patterns in its training data.

    Why it fails

    This describes underfitting, where useful progress is still available.

    Do this instead

    Distinguish a model that has learned too little from one that has learned training-specific details.

  • Common mistake

    Treating familiar examples as evidence of reliable performance on new data

    What it looks like

    A model performs very well on the data used for training but has not been evaluated on unseen examples.

    Why it fails

    Success on familiar examples does not establish generalization.

    Do this instead

    Use validation performance to look for evidence that learned behavior transfers.

  • Common mistake

    Continuing training without watching for a validation decline

    What it looks like

    Validation performance reaches its strongest point, then stalls and worsens while training performance keeps improving.

    Why it fails

    The model is moving into overfitting.

    Do this instead

    Treat the validation trend as a signal that further training may no longer improve generalization.

Check Your Reasoning

MEDIUM

A model's performance on training data improves throughout training. Its validation performance improves at first, then stops improving, and finally worsens. Identify the training stage at the beginning and the stage at the end. Then explain what happened to optimization and generalization.

Hints
  • At the beginning, ask whether the model has captured all relevant patterns.
  • At the end, compare the direction of training performance with the direction of validation performance.
  • Use optimization for progress on training data and generalization for reliability on unseen data.
Worked example

Reasoning through the trend

Interpret a model whose training performance improves continuously, while validation performance first improves and later declines.

  1. 1
    Initial stage

    The model is underfit because it has not yet captured all the relevant patterns in the training data.

  2. 2
    Improving stage

    Training and validation performance improve together, so optimization is accompanied by better generalization.

  3. 3
    Declining validation stage

    Training performance continues to improve, but validation performance worsens. The model is learning details specific to the training data.

Result

The model has changed from underfitting to overfitting. Optimization continues, but generalization has stopped improving.

Key Takeaways

  1. 1
    Optimization and generalization measure different kinds of model performance.
  2. 2
    Underfitting means that relevant patterns in the training data have not yet been captured.
  3. 3
    Overfitting begins when training-specific details improve familiar-data performance without transferring reliably to new data.
  4. 4
    Validation performance helps identify when continued training has stopped improving generalization.
  5. 5
    More training data is the strongest general remedy; when that is unavailable, limiting retained information can reduce unrestricted memorization.

At a glance

  • Optimization concerns performance on training data, while generalization concerns performance on unseen data.
  • Training and validation performance often improve together at first, but validation performance can later stall or worsen.
  • That divergence marks the movement from useful learning toward overfitting.
  • More data and limits on retained information can reduce the tendency to memorize training-specific details.

Related concepts

More concepts starting with M