Underfitting
Underfitting occurs when a model is too simple to capture the true structure of the data it is trained on, resulting in high error on both the training set and any held-out evaluation data. The model has effectively failed to learn the task: it misses systematic patterns that were available in the examples it saw. This contrasts with overfitting, where a model memorises training data but fails to generalise.
Think of it like a student who shows up to an exam having only skimmed the chapter headings rather than working through examples. They understand the rough topic but lack the depth to answer specific questions correctly — and they would have done just as poorly on a practice test, so extra study time is clearly what's needed.
Underfitting commonly appears when a neural network is too shallow, when training is stopped far too early, or when regularisation penalties are set so aggressively that the model cannot express any meaningful function. A quick diagnostic is to plot training loss alongside validation loss: if both remain high and plateau together, the model is underfitting rather than diverging.
# A linear model on a clearly non-linear dataset will underfit
from sklearn.linear_model import LinearRegression
model = LinearRegression()
model.fit(X_train, y_train)
print(model.score(X_train, y_train)) # e.g. 0.43 — poor even on training data
Increasing model capacity (more layers, more Parameters), training longer, or reducing regularisation strength typically resolves the problem.
Underfitting is the counterpart to Overfitting and sits at the centre of the bias–variance trade-off; the Loss Function curve is the primary diagnostic. Gradient Descent optimisation and Hyperparameter tuning are the main levers for escaping an underfit regime.
You will encounter underfitting most often when prototyping — using a deliberately small model to iterate quickly — or when applying a model designed for a simpler task to data that turns out to be far more complex.