liveBook · Manning

Early stopping

As explained in Learn Generative AI with PyTorch

A training control method that stops fitting when validation or other monitored performance no longer improves.

Early stopping controls neural-network training by monitoring performance and ending the process when improvement stops. A validation set can indicate when a classifier should stop, while a task-specific metric can guide generative models. section 2.4 section 3.3.3

A practical early-stopping procedure:

  • Choose a monitored measure, such as validation performance or generated-sample MSE. section 2.4 section 3.3.3
  • Inspect outputs during training when numerical loss alone does not show whether the model is producing useful results. section 3.3.3 section 3.5.3

Stopping a GAN that generates multiples of five

Define distance as the MSE between generated numbers' remainders modulo 5 and zero. Instantiate EarlyStop(800), evaluate distance after each generator-training iteration, and break when the generator has not improved for 800 epochs. Printing every 50 epochs shows the outputs progressing toward multiples of five. section 3.5.3

How Learn Generative AI with PyTorch covers it

How deep it goes
Defines a patience-based class and embeds it in training loops, without developing a broader theory of stopping criteria.
Examples
Uses Fashion MNIST classification and GAN-generated curves or multiples of five as monitored training tasks.
What it assumes
Assumes basic neural-network training, loss measurement, epochs, and validation or task-specific performance metrics.
What you can do after
Apply it via a patience-based Python class inside PyTorch training loops.
How it connects
Connects validation sets, model training, GANs, MSE, and performance monitoring.

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 Learn Generative AI with PyTorch. The section links point to the parts of the book it draws on.