AI Logic

Glossary

Epoch

Updated:

A diagram with "Epoch 1", "Epoch 2", …, "Epoch E" arranged from left to right. In each epoch, the model is trained on one full pass over the training data, split into mini-batches at the bottom (the parameters are updated for each mini-batch), and then the loss and accuracy are evaluated and recorded at the top. Below, a note says that the model is trained by repeating the entire training data E times, where E is the number of epochs (a hyperparameter decided before training).

Explanation

In machine learning and deep learning, an epoch is the period during which a model learns from the entire training dataset exactly once. With each epoch, the model learns patterns from the training data and updates its parameters. The concept comes from optimization algorithms and the training process of deep learning: by using the full dataset many times to update the model's parameters, the aim is to avoid overfitting and underfitting. In general, the number of epochs is set in advance as a hyperparameter and is used to evaluate the model's accuracy as training progresses.

Use cases

Epochs are used in the training process in the following ways:

  1. Tracking training progress: the model's performance is evaluated regularly at each epoch, and accuracy and loss are recorded to understand how training is progressing.
  2. Adjusting the learning rate: by changing the learning rate dynamically according to the epoch count, an approach can be adopted that uses large step sizes in the early stages of training and fine-tunes in the later stages (e.g., learning rate decay).
  3. Early stopping: if the loss on the validation data stops improving as the epochs increase, training is stopped early to prevent overfitting.
  4. Saving the model: by saving the model's state regularly at each epoch, the model from the epoch with the best performance can be used later.

The epoch is an important element in training deep learning models. Because it strongly affects the effectiveness and accuracy of training, it is important to set it appropriately.

FAQ

Q. Why are epochs needed?
A.

By learning from the entire training dataset many times, the model learns more generalized patterns and improves its accuracy.

Q. How is the number of epochs decided?
A.

A predetermined number of epochs is often used, but early stopping may also be used while watching how the validation loss changes.

Q. What happens during an epoch?
A.

The whole dataset is split into mini-batches, which are fed to the model in turn; the loss is computed, and the parameters are updated through backpropagation.