#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
📉 FREE · INTERACTIVE

Overfitting Visualizer: When a Model Learns the Noise

Move the degree slider and watch a curve go from too simple to too wiggly, with real error numbers.

  • 🎚️ Degree slider
  • 📈 Train vs test error
  • 🧲 Ridge λ

How to use the Overfitting Visualizer

  1. 1. Generate dataPick a true pattern, the number of training points, the noise and a seed.
  2. 2. Fit and compareSee the fitted curve and the training and test error for every degree.
  3. 3. ExperimentSlide the degree, add regularisation or more points, and watch the errors change.

What you're seeing

The tool draws noisy points from a known pattern, fits a polynomial by least squares (Householder QR, for numerical stability) and measures the root-mean-square error on the training points and on 200 fresh test points. A low degree can't bend enough: that's underfitting, with both errors high. A high degree bends to pass through every noisy point: that's overfitting, where training error is tiny but test error explodes. The best degree is where test error is lowest.

Worked example

With the defaults (sin(2πx), 15 training points, noise 0.2, seed 1), a straight line (degree 1) has training RMSE 0.5311 and test RMSE 0.4864, which is underfitting. Degree 3 gives 0.2278 training and 0.3455 test, the lowest test error of any degree. Degree 9 drops training error to 0.1204, but test error jumps to 5.3231. Degree 14 passes through all 15 points exactly (training error 0) and its test error is enormous. Add ridge regularisation with λ = 0.0001 and degree 9's test error falls to 0.8782.

Lessons

  • Training error alone always prefers the most complex model; judge models on data they haven't seen.
  • More training data lets a flexible model fit the pattern rather than the noise.
  • Regularisation (λ) penalises large coefficients, taming high-degree curves.
  • Fits were checked against NumPy's polyfit.

Frequently asked questions

Why do the errors change when I change the seed?

A new seed draws new random points, as if you'd collected a different sample. Overfitting shows up for every seed, but the exact numbers move.

Is this the same as the bias–variance trade-off?

Yes: low degrees have high bias, high degrees have high variance, and the best test error balances the two.

Is the overfitting visualizer free?

Yes. You can open the overfitting visualizer and enter everything without signing up. When you fit the curves for the first time, we ask once for your name and WhatsApp number; after that it, and every other Uncodemy tool, opens straight away.

More free tools

See all free tools