Skip to content
BIASED

Bias–variance decomposition

Block 1 of 7~2 min

Two trees from one distribution

The topic Decision trees ended with two observations. A fully grown tree fits its training set exactly and still loses to a tree of depth 3 on new data. And two trees grown on samples from the same distribution disagree almost everywhere. "Flexible models overfit" is true but vague. This topic makes it precise.

Both observations are about a learning method, the procedure that turns a training set into a model, not about one fitted model. The training set is random, so the fitted model is random too. Throughout the topic the task is regression with squared loss.

The notation follows the topic Conditional expectation of Probability Theory. Pairs (X,Y)(X, Y) come from a fixed distribution. The regression function m(x)=E[Y∣X=x]m(x) = \mathbb E[Y \mid X = x] is the best predictor under squared loss, and σ2(x)=Var⁡(Y∣X=x)\sigma^2(x) = \operatorname{Var}(Y \mid X = x) is the noise at xx. A training set D=(xi,yi)i=1nD = (x_i, y_i)_{i=1}^n holds nn independent draws, and the method maps it to a function f^D\hat f_D. The symbols ED\mathbb E_D and Var⁡D\operatorname{Var}_D average over training sets of size nn.

One new object does most of the work. The average model is the prediction at xx averaged over all training sets the method could have seen:

fˉ(x)=ED[f^D(x)].\bar f(x) = \mathbb E_D\big[\hat f_D(x)\big] .

Nobody can fit it: it needs infinitely many training sets. But it separates two ways to fail. A method can be wrong on average, with fˉ\bar f far from mm. Or it can be right on average while every single fit wanders off in its own direction.

Answers are saved on the server and tied to this browser until you sign in.

Go deeper — optional

Code and labs do not count toward the main percentage or the certificate.

  • Bias–variance on polynomial regressionoptional

    Average predictions over seeds: bias², variance, MSE. Self-check in the notebook.

    ~25 min · easier on a computer · Bias–variance topic read.

    Self-check in the notebook — not part of mastery or the certificate.