Compare performance on seen and unseen data
Underfitting happens when a model fails to learn useful structure from the training set. Overfitting happens when training performance looks strong but the learned patterns generalize poorly. Look at the same error metric on training and validation data before diagnosing either situation.
Read a small worked example
Suppose three regression models have mean absolute errors of 12 and 13, 3 and 11, and 5 and 6, on training and validation sets respectively. High error on both sets makes the first model a candidate for underfitting. The large gap in the second makes it a candidate for overfitting. The third gives the lowest validation error in this comparison.
Rule out a misleading split
A validation set may be harder because its examples come from a different time or population. Compare the splits before treating a performance gap as proof of overfitting. Keep related records together when appropriate and prevent future information or copies of training examples from entering validation.
Change one variable and rerun the comparison
For possible underfitting, try better features, more training, or a model with more capacity. For possible overfitting, try a simpler model, stronger regularization, or earlier stopping. Plot training and validation error as the model trains, and change one variable so you can interpret the result.
Reserve the test set for the chosen model
Choose the model and settings using validation results, then report the final test score once. Record the metric, baseline, and split method so another reader can understand the comparison. If you repeatedly pick settings using the same test results, those results lose value as an independent check.
Related guides
Further reading. Google Machine Learning Crash Course on overfitting.
