liveBook · Manning

Early stopping

As explained in Machine Learning Algorithms in Depth

Early stopping is a training procedure that terminates optimization when performance on a validation criterion stops improving.

Early stopping is a regularization procedure that ends training when validation loss stops improving. If training loss continues to fall while validation loss rises, further optimization may worsen generalization. Stopping at that point can also save computation. section 10.1 section 10.6

Use validation loss to decide when to stop:

  • After each epoch, compare validation loss with its best value so far. An epoch is one pass through the training dataset. section 10.1
  • If validation loss fails to improve for several epochs, stop training; save a model checkpoint rather than relying only on the final epoch. section 10.1 section 10.2.1

MNIST training

In a Keras/TensorFlow multilayer perceptron or LeNet-style CNN, record training and validation loss across epochs and use an EarlyStopping callback. The CNN example stops when validation loss has not improved over several epochs. Its loss and accuracy plots make the training–validation difference visible. section 10.1 section 10.2.1

How Machine Learning Algorithms in Depth covers it

How deep it goes
Defines the stopping signal and illustrates a several-epoch criterion, but does not derive a stopping rule mathematically.
Examples
Uses MNIST multilayer-perceptron and convolutional-network training, with training and validation loss curves.
What it assumes
Assumes familiarity with epochs and training and validation loss; explains early stopping as a form of regularization.
What you can do after
Apply it via a Keras/TensorFlow EarlyStopping callback while monitoring validation loss and saving a model checkpoint.
How it connects
Connects validation loss and model checkpoints to regularization alongside weight decay and dropout.

Also explained in

Compare how 9 books explain early stopping →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning Algorithms in Depth. The section links point to the parts of the book it draws on.