Underfitting Detection

What Is Underfitting?

Underfitting happens when a machine learning model does not learn enough from the training data. The model is too simple, poorly trained, or missing important information.

01

Model does not learn enough

02

Training score stays low

03

Test score also stays low

04

Model performs poorly everywhere

An underfit model is not useful because it cannot even perform well on the data it studied.

Why Underfitting Detection Matters

Underfitting detection matters because a model with poor training and test performance is not ready for real use.

Example

Training Accuracy — 58%

Test Accuracy — 56%

The model performs poorly on both familiar data and unseen data.

Low Training Score and Low Test Score

The most common sign of underfitting is a low training score and a low test score.

Training Score

Performance on data the model learned from.

Test Score

Performance on unseen data.

If both scores are low, the model is likely too weak or has not learned enough.

Training Performance

Training performance shows how well the model performs on the training dataset. If training performance is low, the model is struggling even with familiar data.

Example

Training Accuracy — 55%

The model correctly predicts only 55% of the training examples.

The model has not learned the training data well.

Test Performance

Test performance shows how well the model performs on new data it did not train on.

Example

Test Accuracy — 54%

The model correctly predicts only 54% of unseen examples.

The model also fails on new data.

Performance Pattern for Underfitting

Underfitting usually appears as poor performance on both training and test data.

Underfitting Pattern

Training Accuracy — 60%

Test Accuracy — 58%

The scores are close, but both are weak. This suggests underfitting.

Underfitting vs Overfitting

Underfitting and overfitting are different problems.

Underfitting

Low training performance and low test performance.

Training Accuracy = 58%

Test Accuracy = 56%

Overfitting

High training performance and low test performance.

Training Accuracy = 99%

Test Accuracy = 65%

Underfitting vs Good Fit

A good fit means the model performs well on both training and test data. Underfitting means the model performs poorly on both.

Good Fit

Training Accuracy = 91%

Test Accuracy = 89%

Strong performance on both.

Underfitting

Training Accuracy = 58%

Test Accuracy = 57%

Weak performance on both.

Training Loss and Test Loss

Loss measures prediction error. For underfitting, both training loss and test loss are usually high.

Example

Training Loss — 1.20

Test Loss — 1.25

The model makes large errors on both training data and unseen data.

Underfitting in Classification

In classification, underfitting can appear as low accuracy, low precision, low recall, low F1 score, or weak ROC-AUC.

Example

Training Accuracy — 57%

Test Accuracy — 55%

Training F1 Score — 0.42

Test F1 Score — 0.40

The model is weak on both training and test data.

Underfitting in Regression

In regression, underfitting can appear as high training error and high test error.

Example

Training RMSE — 65

Test RMSE — 68

The model makes large numerical errors on both familiar and unseen data.

Why Underfitting Happens

Underfitting can happen for many reasons. Detecting the cause helps decide how to fix the model.

Common Causes
  • Model is too simple
  • Not enough training time
  • Poor feature selection
  • Missing important features
  • Too much regularization
  • Data is too noisy
  • Poor data quality
  • Wrong algorithm for the task
  • Hyperparameters are poorly chosen
  • Data preprocessing removed useful information

Cause 1: Model Is Too Simple

A model may underfit if it is too simple for the problem.

House Price Prediction

Only Feature — Number of bedrooms

Missing Features

  • Location
  • Square footage
  • House age
  • Bathrooms
  • Neighborhood

The model does not have enough information.

Cause 2: Not Enough Training

A model may underfit if it has not trained long enough.

Neural Network — 1 Epoch

Training Accuracy — 45%

Test Accuracy — 44%

Possible fix: Train for more epochs while monitoring validation performance.

Cause 3: Poor Features

If the features are weak, irrelevant, or incomplete, the model may underfit.

Weak Features
  • Favorite color
  • Shoe size
  • Random ID
Useful Features
  • Study hours
  • Attendance
  • Quiz scores
  • Assignment completion

Cause 4: Too Much Regularization

Regularization helps prevent overfitting, but too much regularization can cause underfitting.

Too Much Regularization

Model weights are forced too small.

Result — The model cannot capture important relationships.

Possible Fix — Reduce regularization strength.

Cause 5: Wrong Algorithm

Some algorithms are not suitable for certain problems.

Example

A simple linear model is used for a complex, non-linear relationship.

Problem — The model cannot represent the real pattern.

Possible Fix — Choose a model that can capture more complex patterns.

Cause 6: Poor Data Quality

Poor data quality can make it difficult for the model to learn useful patterns.

Data Quality Problems
  • Incorrect labels
  • Missing values
  • Inconsistent formatting
  • Too many noisy examples
  • Features measured incorrectly
  • Important data missing

Cause 7: Too Much Preprocessing

Preprocessing is useful, but too much preprocessing can remove important meaning.

Example

Original Text — "This product is not good."

Poorly Processed Text — "product good"

The meaning changed. The model may learn weaker patterns.

Training Curves for Underfitting

Training curves can help detect underfitting while the model is training.

Underfitting Pattern
  • Training loss stays high
  • Validation loss stays high
  • Training accuracy stays low
  • Validation accuracy stays low

Epoch 1 — Training 45%, Validation 44%

Epoch 10 — Training 55%, Validation 54%

Epoch 30 — Training 58%, Validation 56%

Learning Curves for Underfitting

Learning curves show how performance changes as more training data is added.

Underfitting Learning Curve

Training Score — Low

Validation Score — Low

Gap — Small

The model may be too simple or missing important features.

Low Gap Can Still Be Bad

Sometimes training and test scores are close together, but both are poor. This is not good generalization.

Example

Training Accuracy — 61%

Test Accuracy — 60%

Gap — Small

The model is consistently weak. A useful model needs strong performance, not just similar scores.

Underfitting and Bias

Underfitting is often connected to high bias. High bias means the model makes overly simple assumptions about the data.

Example

Oversimplified Assumption — House price only depends on bedrooms.

Reality — House price also depends on location, size, condition, market trends, and more.

The model is too limited.

Bias-Variance Idea

Underfitting is usually related to high bias, while overfitting is usually related to high variance.

High Bias

Model is too simple and misses patterns.

Leads to underfitting.

High Variance

Model is too complex and memorizes training data.

Leads to overfitting.

Real-World Example: House Price Prediction

Underfit Model

Only Feature — Number of bedrooms

Missing — Location, square footage, age, bathrooms, nearby schools, market trends

Training RMSE — $120,000

Test RMSE — $125,000

The model performs poorly everywhere.

Real-World Example: Spam Detection

Underfit Model

Only Feature — Email length

Missing — Suspicious links, sender reputation, keywords, formatting, attachments

Training Accuracy — 60%

Test Accuracy — 59%

The model is too simple to identify spam patterns.

Real-World Example: Image Classification

Classify Cats and Dogs

Underfit Model — Too few layers or too little training

Training Accuracy — 52%

Test Accuracy — 51%

The model barely performs better than guessing.

How to Fix Underfitting

Ways to Fix Underfitting
  • Use a more complex model
  • Add useful features
  • Improve feature engineering
  • Train for more epochs
  • Reduce excessive regularization
  • Choose a better algorithm
  • Improve data quality
  • Tune hyperparameters
  • Use better preprocessing
  • Add non-linear features when needed

Use a More Complex Model

If the model is too simple, increasing complexity can help.

Possible Models
  • Decision tree
  • Random forest
  • Gradient boosting
  • Neural network
  • Polynomial regression

Goal: Use a model that can capture the pattern without overfitting.

Add Useful Features

Adding useful features gives the model more information to learn from.

House Price Features
  • Square footage
  • Location
  • Number of bathrooms
  • House age
  • Lot size
  • Distance to city center

Better features can reduce underfitting.

Improve Feature Engineering

Feature engineering can create stronger inputs from raw data.

Examples

Raw Feature — Birth year → Engineered Feature — Age

Raw Feature — Purchase date → Engineered Features — Day of week, month, holiday season

Good engineered features can help the model learn patterns more easily.

Train Longer

If the model has not trained enough, more training may help.

E1

Epoch 1 — Training Accuracy = 45%

E10

Epoch 10 — Training Accuracy = 65%

E30

Epoch 30 — Training Accuracy = 82%

Training longer helped the model learn. Monitor validation performance to avoid overfitting.

Reduce Regularization

If regularization is too strong, reducing it may help the model learn more.

Too Much Regularization

Model weights are forced too small.

Result — The model cannot capture important relationships.

Fix — Reduce regularization strength carefully.

Tune Hyperparameters

Hyperparameters affect how a model learns. Poor hyperparameter choices can cause underfitting.

Hyperparameters
  • Learning rate
  • Number of epochs
  • Tree depth
  • Number of layers
  • Regularization strength
  • Number of estimators
  • Batch size

Tuning them can improve performance.

Common Mistakes

Common Mistakes
  • Thinking a small train-test gap always means good performance
  • Ignoring low training score
  • Using a model that is too simple
  • Removing too many useful features
  • Using too much regularization
  • Not training long enough
  • Looking only at accuracy
  • Ignoring data quality
  • Confusing underfitting with overfitting

Summary

Key Takeaways
  • Underfitting happens when a model does not learn enough.
  • The main warning sign is low training score and low test score.
  • Low training performance means the model struggles even on familiar data.
  • Low test performance means the model also fails on new data.
  • A small train-test gap is not good if both scores are low.
  • Underfitting can happen because the model is too simple, features are weak, training is too short, or regularization is too strong.
  • Underfitting can appear in classification and regression metrics.
  • Fixes include using a stronger model, adding useful features, improving data quality, training longer, and tuning hyperparameters.

Practice Prompt

A model has 57% training accuracy and 55% test accuracy. Explain why this suggests underfitting. Then list three changes that could help the model learn stronger patterns.

Need Help?

Ask the AI if you need help understanding underfitting, low training scores, low test scores, high bias, weak features, training curves, or how to improve an underfit model.