When a curve is fitted to measured points, see with pictures and motion what decides whether it hits or misses on new data.
Fit polynomial and Gaussian-basis linear models to synthetic data on firing temperature and relative density (Data A), made for teaching purposes. Check against the equations in the text, using the numbers on the screen, that the training error keeps falling as the degree rises while the validation error starts to grow partway (overfitting); that regularization λ suppresses this; how bias and variance trade off behind it; and that in Bayesian linear regression the predictive uncertainty splits into two parts, one from noise and one from lack of knowledge.
Fit a curve to the recorded points, the way you bend a wire. Will a curve that fits the points exactly also fit newly measured data?
These are synthetic data for teaching purposes (the true relation between temperature and packing is a made-up formula, shown by the gray dashed line).
Measure 15 points again and again in the same way, fit a curve each time, and overlay the curves. Compare how the shape changes with how easily the curve bends.
These are synthetic data for teaching purposes (each new measurement is made by adding a different scatter to the same made-up formula).
Each time 1 point is measured, the band showing “the curve probably passes around here” is redrawn. Compare the width of the band at measured and unmeasured temperatures.
These are synthetic data for teaching purposes (points are measured one at a time from the same made-up formula as in A and B).
Polynomial fit (Data A: firing temperature and relative density)
Fit the degree-d polynomial f(s; w) = w0 + w1s + … + wdsd(plus the 88 % baseline) by least squares or ridge regression.
The horizontal axis is the polynomial degree d (d + 1 coefficients) and the vertical axis is the RMSE (%, logarithmic scale). Each value is obtained by refitting each degree with the same training data and the same λ. The vertical line marks the current degree. Note that the validation RMSE rarely falls below the noise standard deviation σ. Values below 0.01 % are drawn at the bottom edge.
The target value is y − 88 % (w0 is the deviation from 88 %). When the model overfits, the absolute values of the coefficients become orders of magnitude larger, and positive and negative terms cancel each other so that the curve passes through the training data.
Make many data sets under the same conditions and overlay the fits
Draw N points from Data A and fit, repeated for L sets. The deviation of the mean fit f̄(s) from the true function g(s) is the bias, and the scatter among sets is the variance.
Bayesian linear regression: predictive distribution and the two kinds of bands
Click (tap) the figure to add an observation at that position. With the keyboard, use “Observe at this s” on the right.
The description of this simulator (procedure, formulas, conditions, questions) is on the explanation page “Explanation of the Regression and Overfitting Simulator”.
Back to Machine Learning — From Probability to GPT (Contents) | Text: Chapter 6, Section 6.2, Chapter 8, Section 8.6 | Equations and explanation (explanation page) | Equations are typeset with the browser’s built-in MathML (no external library).