Reading a loss curve
Why it matters A training run prints a loss after every pass over the data. Knowing when it stopped getting better tells you when to stop training.
A training log usually has two numbers per epoch (one pass over the data): the loss on the training data, and the loss on held-back validation data the model never trains on. Training loss nearly always keeps falling. Validation loss falls, then often turns back up: the model has started memorising its training data instead of learning the pattern.
Epoch: one full pass over the training data.
The best moment to stop is the epoch where validation loss is lowest. np.argmin finds the position of the smallest value.
Recap Watch validation loss, not training loss. Its lowest point is your best model.
Words and symbols in this lesson
- array
- a NumPy block of numbers, all the same type, that does maths on every item at once
- epoch
- one full pass over the training data
train_loss and val_loss are given (epochs 1 to 15). Set best_epoch to the epoch number (counting from 1) with the lowest validation loss, and plot both curves on ax with labels "train" and "validation", in that order.
Spotted a problem in this lesson? Report it · Ask about this lesson
This exercise opens soon
Finish the lesson before it and this one unlocks. The whole course is free, no account needed, and you can read this lesson right now.
This browser is blocking cookies for learn.floati.life, so lessons you finished here cannot open in order. Allow cookies for this site and reload.