📈 Model fitting
Fit a polynomial to noisy samples of a sine and watch the classic trade-off: too simple underfits, too flexible memorises the noise. Every number and plot follows the sliders.
Polynomial degree: 3 Noise (σ): 0.25 Samples: 30 New sample: 0Train error 0.214, test error 0.226. The lowest test error is at degree 3. A good fit: low test error without chasing the noise.
Raise the degree past 3 and watch the test error climb while the train error keeps falling. More samples or less noise move the sweet spot. Open Cells to see every step, or Graph to see what depends on what.