Understanding Underfitting in Machine Learning

Learn what underfitting is, why it happens, how to detect it, and how to fix it to improve your machine learning models.

🔰 beginner
⏱️ 35 minutes
👤 SuperML Team

· Machine Learning · 2 min read

📋 Prerequisites

  • Basic understanding of machine learning concepts

🎯 What You'll Learn

  • Understand what underfitting is and why it occurs
  • Learn to detect underfitting in your models
  • Explore strategies to fix underfitting
  • Build models that learn effectively without underfitting

Introduction

Underfitting is a situation in machine learning where a model is too simple to capture the underlying patterns in the training data.

It leads to:

✅ Poor performance on the training set.
✅ Poor performance on the test set.


1️⃣ What is Underfitting?

Underfitting occurs when:

✅ A model fails to learn the relationships in the training data.
✅ The model is too simplistic for the complexity of the task.

Example: Using a linear model for a dataset with a clear nonlinear relationship.


2️⃣ Why Does Underfitting Occur?

Model is too simple: Insufficient complexity to capture patterns.
Insufficient training: Not enough epochs or iterations.
Over-regularization: Too much regularization can oversimplify the model.
Irrelevant or insufficient features: Using poor-quality data.


3️⃣ How to Detect Underfitting

High bias: Both training and test errors are high.
No improvement with training: Loss remains high even as training progresses.
Visualization: The model does not capture trends in data plots.


4️⃣ Strategies to Fix Underfitting

a) Increase Model Complexity

Use more complex models (e.g., deeper neural networks, higher-degree polynomials).

b) Train Longer

Increase the number of epochs or iterations to allow the model to learn better.

c) Reduce Regularization

Decrease L1/L2 regularization strength to allow the model to learn more.

d) Feature Engineering

✅ Add relevant features.
✅ Remove irrelevant features.
✅ Use feature extraction methods to capture better signals.


5️⃣ Example in Python

from sklearn.linear_model import LinearRegression, PolynomialFeatures
from sklearn.pipeline import make_pipeline

# Example: Using polynomial regression to increase model complexity
degree = 3  # Increase degree to capture nonlinear patterns
model = make_pipeline(PolynomialFeatures(degree), LinearRegression())
model.fit(X_train, y_train)

Conclusion

✅ Underfitting occurs when your model is too simple to capture patterns in data.
✅ It can be addressed by increasing model complexity, training longer, reducing regularization, and using better features.

By understanding underfitting, you can build balanced models that learn effectively and generalize well.


What’s Next?

✅ Compare underfitting vs overfitting to understand the bias-variance trade-off.
✅ Experiment with tuning your models to find the right complexity.
✅ Continue your structured machine learning journey on superml.org.


Join the SuperML Community to discuss your model tuning experiences and learn collaboratively.


Happy Learning! 📈

Back to Tutorials

Related Tutorials

🔰beginner ⏱️ 40 minutes

Understanding Overfitting in Machine Learning

Learn what overfitting is, why it occurs, how to detect it, and how to prevent it to build better machine learning models.

Machine Learning2 min read
machine learningoverfittingmodel generalization +1
🔰beginner ⏱️ 50 minutes

Dimensionality Reduction

Learn what dimensionality reduction is, why it matters in machine learning, and how techniques like PCA, t-SNE, and UMAP help simplify high-dimensional data for effective analysis.

Machine Learning2 min read
machine learningdimensionality reductiondata preprocessing +1
🔰beginner ⏱️ 50 minutes

Genetic Algorithms

Learn what genetic algorithms are, how they mimic natural selection to solve optimization problems, and how they are used in machine learning.

Machine Learning2 min read
machine learninggenetic algorithmsoptimization +1
🔰beginner ⏱️ 40 minutes

Introduction to Natural Language Processing (NLP)

A clear, beginner-friendly introduction to NLP, explaining what it is, why it matters, and its key tasks with practical examples.

Machine Learning2 min read
nlpmachine learningdeep learning +1