Bias, variance, and everything between

Polynomial Curve Fitting Playground

Shape a dataset, vary model capacity, and watch the gap between training performance and holdout performance reveal underfitting and overfitting.

Fit the data yourself

Blue points train the polynomial. Green diamonds are withheld from fitting and measure how well the curve generalizes. Click empty plot space to add a training point, or drag any point to reshape the problem.

Read the error curves

Training error usually falls as flexibility rises. Holdout error often falls first, then rises when the model starts fitting noise instead of structure.

Underfit

Low capacity cannot follow the curve, so both errors remain high.

Useful capacity

The model captures the durable shape without chasing every noisy point.

Overfit

Training error is tiny, but the holdout gap exposes fragile behavior.

Check your intuition

Every choice gives immediate feedback. Try another answer at any time to compare the reasoning.

Which metric should guide the final degree choice?

Choose an answer.

A straight line misses a curved pattern on both training and holdout data. What is happening?

Choose an answer.

A degree-14 curve changes dramatically when one point moves. Which problem dominates?

Choose an answer.

Questions that matter

Polynomial fitting is a small laboratory for model selection ideas that recur across machine learning.

Why not always choose the degree with the lowest training error?

A sufficiently flexible model can memorize the training samples. Holdout data tests whether the learned pattern survives beyond those samples.

What does polynomial degree control?

It controls model capacity. Higher degrees allow more bends and local variation, which can represent richer patterns but also amplify noise.

Why can holdout error form a U shape?

At first, added flexibility reduces systematic error. After useful structure is captured, further flexibility starts increasing sensitivity to sampling noise.

Is degree three always the correct answer?

No. The useful degree depends on the generating process, sample size, noise, split, and regularization. This dataset happens to contain a cubic backbone.

Enjoy this tool? Build your own with Super