Do Multiple Runs

Explore how the number of epochs affects the accuracy of results.

Epochs

The next improvement we can make is to repeat the training several times against the dataset. This is sometimes called an epoch. So, a training session with 10 epochs means running through the entire training dataset 10 times. Why would we do that, especially it takes 10, 20, or even 30 minutes at a time? It is worth doing because we’re helping those weights do that gradient descent by providing more chances to creep down those slopes.

Let’s try it with two epochs. The code changes slightly because now we add an extra loop around the training code. The following code shows this outer loop to help us see what’s happening:

Get hands-on with 1200+ tech skills courses.