Varun Vemulapalli

Day 8 of 100 · Phase 1: Foundations

Overfitting

2 min readBy Varun Vemulapalli

Your model scores 99% on the data it trained on. On new data, it falls apart.

That's overfitting: the model memorized the practice questions instead of learning the subject.

Video explainer · 1:48
Key takeaway

Overfitting is when a model memorizes its training data instead of learning the pattern, so it looks great in practice and fails on anything new.

Day 8 visual: Overfitting
The visual from the original post.

The concept

Two students prepare for an exam:

  • Student 1 memorizes last years answers word for word.
  • Student 2 learns why the answers are right.

On last years questions, both score 100%. On this years new questions, Student 1 falls apart. Thats overfitting.

An overfit model fits its training data too closely, including noise and coincidences, so it fails on new data. The opposite problem, underfitting, is a model too simple to learn even the real pattern.

Walkthrough: forecasting a cafés daily coffee sales

A café has 60 days of sales data. Features: day of week, temperature, rain, local events.

Simple model: learns a few broad rules.

  • Weekends sell more, cold days sell more, rain sells less.
  • On the 60 training days: typically off by about 20 cups.
  • On the next 30 new days: still off by about 20 cups. Consistent.

Overly complex model: learns hundreds of tiny rules.

  • It notices that one rainy 14°C Tuesday, with a marathon in town, sold 410 cups, and builds a rule just for that day.
  • On the 60 training days: off by about 2 cups. Looks amazing.
  • On the next 30 new days: off by about 70 cups. Worse than the simple model.

It memorized one-off events instead of learning what drives sales.

How to catch it

Always hold some data back.

  • Train on part of the data (say 80%).
  • Test on the 20% the model never saw.
  • Great training scores but much worse test scores? Youre overfitting.

How to fix it

  • More data, so coincidences wash out.
  • A simpler model, or fewer features.
  • Stop training earlier, before it starts memorizing.
  • Regularization: a penalty that discourages overly complex rules.

Where you see it at work

  • Banking: a credit model that looks perfect on last years customers but stumbles when the economy shifts.
  • Retail: a demand forecast that learned one viral week and keeps expecting it again.
  • Business analysis: a trend line that fits 10 data points perfectly tells you less than you think.

In one sentence

Overfitting is when a model memorizes its training data instead of learning the pattern, so it looks great in practice and fails on anything new.

Your turn: have you ever seen a forecast or report that was too perfect? What happened next? 👇

Join the discussion on LinkedIn