What Learning Curve Meaning, Applications & Example
Plot showing model performance versus training size.
What is a Learning Curve?
A Learning Curve is a graphical representation of a model ’s performance over time, typically showing the relationship between training iterations (or epochs) and error rates (e.g., loss or accuracy). It helps to visualize how well a model is learning, and whether it is overfitting , underfitting, or converging as expected.
Types of Learning Curves
- Training Curve: Shows the error or accuracy on the training dataset across iterations.
- Validation Curve: Shows the error or accuracy on a validation set , used to detect overfitting or underfitting .
Applications of Learning Curves
- Model Evaluation : Helps assess whether a model is improving during training or if adjustments are needed (e.g., more epochs, learning rate changes).
- Hyperparameter Tuning : Used to track the effect of hyperparameter changes (like batch size, learning rate) on model performance.
- Overfitting Detection: If the training curve keeps improving but the validation curve starts worsening, it indicates overfitting.
Example of Learning Curve
A typical learning curve might look like this:
import matplotlib.pyplot as plt
# Example learning curve with training and validation loss
epochs = [1, 2, 3, 4, 5]
training_loss = [0.8, 0.6, 0.5, 0.4, 0.3]
validation_loss = [0.85, 0.7, 0.65, 0.6, 0.75]
plt.plot(epochs, training_loss, label='Training Loss')
plt.plot(epochs, validation_loss, label='Validation Loss')
plt.xlabel('Epochs')
plt.ylabel('Loss')
plt.title('Learning Curve')
plt.legend()
plt.show()