liveBook · Manning

Epoch

As explained in Grokking Machine Learning

One iteration of a training loop that applies an update procedure to a selected training example.

How does a line gradually learn to fit house prices? Start with a guess, pick one house at random, and adjust the line. One trip through that loop is called an epoch here. The number of epochs sets how many such attempts the training algorithm makes; it does not mean one pass through every house. section 3.3

An epoch follows a short routine:

  • Select one training point at random. section 3.3
  • Apply the model’s update rule. In linear regression, the square trick adjusts the slope and intercept to bring the line closer to that point. section 3.3
  • Repeat for the chosen number of epochs, then inspect the resulting model. section 3.3

The same loop appears in the perceptron algorithm, but selecting a point does not always move the line: a correctly classified point leaves it alone, while a misclassified point prompts an update. The epoch count and learning rate are hyperparameters. Possible stopping rules include a fixed count, an error threshold, or error that has stopped changing much. Repetition can produce a good classifier, but it does not always find the best one. section 5.3

Figure 3.16 Drawing some of the lines in our algorithm, as we approach a better solution. The first graphic shows the starting point. The second graphic shows the first 10 epochs of the linear regression algorithm. Notice how the line is moving closer to fitting the points. The third graphic shows the first 50 epochs. The fourth graphic shows epochs 51 to 10,000 (the last epoch).

Compare the starting line with its position after 10, 50, and up to 10,000 epochs. The plots make the effect of repeated small updates visible. section 3.3

How Grokking Machine Learning covers it

How deep it goes
Defines an epoch as one loop iteration and shows repeated updates, stopping criteria, and plotted progress.
Examples
Shows a house-price regression loop and plots its fitted line after different epoch ranges.
What you can do after
Operate/configure it by choosing an epoch count and using error behavior to decide when to stop.
How it connects
Links epochs to linear regression, the perceptron algorithm, learning rate, and training error.

Also explained in

Compare how 10 books explain epoch →

Related concepts

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