Interactive demo · Bayesian and Probabilistic Machine Learning · Chapter 3

The bias-variance decomposition and regularisation

Draw L = 100 data sets of N points from sin(2πx) plus noise, fit the same flexible model (24 Gaussian basis functions and a bias) to each by regularised least squares, and look at the fits. A large λ makes every fit similar but systematically wrong (high bias); a small λ makes the fits track the noise (high variance). The expected squared error splits exactly as (bias)2 + variance + noise.

View

Regularisation ln λ

Points per data set N

Noise standard deviation σ

Try these

Data set l uses the seeded generator with seed 1000 + l, the same numbers as bias_variance_experiment in the Python code. The bias and variance integrals are averages over 200 equally spaced x on [0, 1] (uniform p(x)); the test error shown is (bias)2 + variance + σ2, its expectation over test noise. Basis functions: Gaussians of width 0.1 with centres equally spaced on [0, 1]; the penalty (λ/2)wTw includes the bias weight, as in (3.27).

In the lecture notes