Command Palette

Search for a command to run...

What Is Overfitting, Underfitting, and the Ideal Model

A complete guide to understanding Underfitting, Overfitting, and the Ideal Model in Machine Learning β€” including their characteristics and how to address them.

Yudi Suryawan
Rabu, 29 Juli 2026
3 min read

In the world of Machine Learning and Data Science, one of the biggest challenges when training a model is finding the right balance between the model's ability to learn from training data and its ability to generalize to new test data.

Here are the 3 main model performance conditions you need to understand:

#1. Underfitting#

The model is too simple and fails to capture even the basic patterns in the data.

πŸ’‘ Analogy: Like a student who only memorized one basic formula and then failed every type of exam question.

##Characteristics of Underfitting:#

  • Both train and test scores are low/poor.
  • The error rate is very high on both datasets.
  • Learning curve: both train error and validation error remain high.

##Main Causes:#

  1. The model is too simple (e.g., using Linear Regression for complex/non-linear data patterns).
  2. Missing important features that could better represent the data.
  3. Errors during data preprocessing or feature engineering.

#2. Overfitting#

The model is too complex and memorizes the training data in detail β€” including its noise β€” but fails to generalize when tested on test data.

⚠️ Analogy: Like a student who memorized the answer key for practice questions, but gets confused the moment the numbers in the exam are slightly changed.

##Characteristics of Overfitting:#

  • The train score is very high (nearly 100%), but the test score drops significantly.
  • Too many features or parameters are used.
  • Learning curve: train error is very low, but validation error is very high.

##Main Causes:#

  1. The model is too complex (e.g., a Decision Tree with no depth limit).
  2. No regularization techniques applied (L1/L2 regularization, dropout, etc.).
  3. Too little data relative to the large number of features.

#3. The Ideal Model (Ideal Fit)#

The model learns just enough β€” it captures the essential patterns in the data and can still generalize well to new, unseen data.

##Characteristics of the Ideal Model:#

  • Both train & test scores are high and close in value.
  • The error rate is low and stable.
  • Learning curve: train error and validation error converge at an optimal point.

#Conclusion & How to Fix It#

ConditionKey CharacteristicSolution
UnderfittingTrain & Test both poorAdd features, use a more complex model
OverfittingTrain good, Test poorAdd more data, apply regularization, reduce features
Ideal FitTrain & Test balancedMaintain hyperparameters & use cross-validation