Skip to content
StackDecode
AI & ML Atlas
Neural NetworkstechniqueInteractive simulation

Early Stopping

Stops training when validation performance stops improving.

The idea

Training error keeps falling, but past some point the validation error starts rising as the model memorises the training set. Monitor the validation loss, and when it has not improved for a set number of epochs (the patience), stop and restore the best weights seen.

Watch it run

This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.

training epochs →error
  • training error
  • validation error
  • best epoch

Both curves fall: the model is learning real structure.

epoch:
5
train error:
0.0491
validation error:
0.0449
1/10

A 10-parameter polynomial trained by gradient descent on 12 noisy points.

Step by step

  1. 1Hold out a validation set.
  2. 2After every epoch compute the validation loss.
  3. 3Save the weights when it reaches a new best.
  4. 4Stop once it has not improved for "patience" epochs.
  5. 5Restore the best weights.

Where it is used

Cheap, effective regularisation for any iteratively trained model.

Watch out for

A noisy validation curve can trigger a stop too early; use enough patience.

Related