liveBook · Manning

Epoch

As explained in Deep Learning with PyTorch, Second Edition

One complete pass through the entire training dataset used in training, after which each sample has been used once.

An epoch is one complete pass through the entire training dataset. During that pass, every sample is used once to update the model parameters. section 5.4.3

An epoch is not the same as a training iteration or step. A step usually processes one batch through forward and backward passes; multiple batch steps make up one epoch. When the entire dataset is used in each step, one step equals one epoch. section 5.4.3

Epochs organize the training process:

  • Set a number of epochs or another stopping criterion before running the training loop. section 5.4.3 section 5.4.4
  • Inspect loss and class-specific results across epochs rather than trusting overall accuracy alone. section 13.8

Choosing the number of epochs

A normalized temperature model is trained for 5,000 epochs. Its loss falls from 80.36 initially to about 2.93 by epoch 5,000, while the learned parameters approach the expected Fahrenheit-to-Celsius relationship. The choice of 5,000 is a hyperparameter rather than a universal rule. section 5.4.4

How Deep Learning with PyTorch, Second Edition covers it

How deep it goes
Explains epochs through dataset coverage, batch-step relationships, loop code, stopping choices, and metric interpretation.
Examples
Uses temperature regression for 5,000 epochs and tumor classification outputs after one and ten epochs.
What it assumes
Assumes basic model training, batches, loss, gradients, and parameter updates while defining epoch terminology explicitly.
What you can do after
Apply it via a PyTorch training loop to choose, count, log, and interpret complete passes through training data.
How it connects
Connects epochs with training iterations, batches, DataLoader, gradient descent, loss, hyperparameters, and model evaluation.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with PyTorch, Second Edition. The section links point to the parts of the book it draws on.