Course contentsShow
← Computer Science
Lesson 2806 of 2,87262. Machine Learning FundamentalsFree lesson

What is Overfitting?

Understanding overfitting as when a model learns training data too well, capturing noise instead of underlying patterns.

What is Overfitting?

You'll learn: How overfitting occurs when a model memorizes training data instead of learning generalizable patterns.


The Core Problem

Overfitting happens when your machine learning model learns the training data too well—so well that it captures random noise, quirks, and outliers as if they were meaningful patterns. Instead of discovering the true underlying relationship between features and labels, the model essentially memorizes the training examples.

Think of it like a student who memorizes exam questions word-for-word instead of understanding the concepts. They'll ace practice tests but fail when faced with slightly different questions on the real exam.

How It Manifests

An overfitted model achieves excellent performance on the training set (low training loss) but performs poorly on the test set or new, unseen data. This gap between training and test performance is the telltale sign.

For example, imagine fitting a polynomial curve to predict house prices based on size. An overfitted model might create a wildly complex curve that passes through every single training point perfectly—even capturing random measurement errors—but completely misses the true linear relationship. When you feed it new houses, its predictions will be terrible.

Why It Matters

Overfitting violates the fundamental goal of machine learning: generalization. We don't just want good performance on data we've already seen; we want models that work reliably on future, unseen examples. This is why you split data into training and test sets—to detect overfitting before deploying your model.


Key Takeaway: Overfitting occurs when a model learns training data too precisely, capturing noise instead of true patterns, resulting in poor performance on new data despite excellent training performance.