Adjust the simulation parameters in the sidebar and click Run Simulation to generate results. Training MSE, test MSE, bias\(^2\), and variance are computed from independent Monte Carlo draws.

Bias–Variance Decomposition:

$$\mathbb{E}\left[(y - \hat{f}(x))^2\right] = \underbrace{\left[\text{Bias}(\hat{f}(x))\right]^2}_{\text{Bias}^2} + \underbrace{\text{Var}(\hat{f}(x))}_{\text{Variance}} + \underbrace{\sigma^2}_{\text{Irreducible}}$$

MC Estimates (across B simulations):

$$\widehat{\text{Bias}^2}(x_0) = \left(\frac{1}{B}\sum_{b=1}^{B} \hat{f}_b(x_0) - f(x_0)\right)^2$$ $$\widehat{\text{Var}}(x_0) = \frac{1}{B}\sum_{b=1}^{B} \left(\hat{f}_b(x_0) - \bar{\hat{f}}(x_0)\right)^2$$

Train MSE

Test MSE

Bias²

Variance

Best Complexity



Loading...

Model Recommendation


Test MSE (red) = Bias² (green) + Variance (amber) + irreducible noise. Training MSE (blue) decreases monotonically with model complexity.

Loading...

Each grey curve is a fitted model from one MC repetition. The true function f(x) is shown in black.


Values shown are averaged over all Monte Carlo repetitions.