Epoch
One complete pass through the entire training dataset
An epoch is one complete pass through the entire training dataset. Training a model typically requires many epochs — the model sees the same data multiple times to learn patterns.
Example
num_epochs = 10
for epoch in range(num_epochs):
for batch in train_loader:
inputs, labels = batch
outputs = model(inputs.cuda())
loss = criterion(outputs, labels.cuda())
loss.backward()
optimizer.step()
optimizer.zero_grad()
print(f"Epoch {epoch + 1}/{num_epochs} complete")
Key Points
- 1 epoch = the model has seen every training sample once
- More epochs generally improve performance up to a point, then overfitting occurs
- Common to train for 3-100+ epochs depending on the task