How is the bias-variance decomposition derived for squared error loss?

Quick Overview

Derive the bias-variance decomposition of expected squared error at a fixed input into noise, squared bias and variance. Tests whether you can set up the expectations over training sets and test noise and justify why each cross term vanishes.

How is the bias-variance decomposition derived for squared error loss?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

How is the bias-variance decomposition derived for squared error loss? Take the usual setting: labels follow $y = f(x) + \varepsilon$ with zero-mean noise, and $\hat f_D$ is a model fit on a random training set $D$. Derive the expected squared error at a fixed input $x$ and show how it splits into noise, squared bias and variance. ```hint Add and subtract Insert the true function inside $(y - \hat f_D(x))^2$ and expand. Later, do the same with the average prediction over training sets. ``` ```hint Cross terms For each cross term, ask which factors are random under the expectation and which are fixed. A zero-mean factor that is independent of the other factor makes the product vanish in expectation. ``` ### What a Strong Answer Covers - The data model and assumptions, including that the test noise is independent of the training set. - What the expectation is taken over, and that $x$ is held fixed. - Both add-and-subtract steps, with a reason each cross term has zero expectation. - The three final terms, named and interpreted, and which one no model can reduce. - The connection to $\mathbb{E}[Z^2] = \mathrm{Var}(Z) + (\mathbb{E}[Z])^2$. ### Follow-up Questions - Why does this decomposition not carry over directly to 0-1 loss or log loss? - How would you estimate the bias and variance terms for a real model when the true function is unknown? - How does averaging over the input distribution change what each term tells you? - How do bagging and ridge regularization move each term?

Overview: Derive the bias-variance decomposition of expected squared error at a fixed input into noise, squared bias and variance. Tests whether you can set up the expectations over training sets and test noise and justify why each cross term vanishes.

PracHub logo
General
Nov 25, 2026
mediumMachine Learning EngineerOtherMachine Learning
0
0

How is the bias-variance decomposition derived for squared error loss?

Take the usual setting: labels follow y=f(x)+εy = f(x) + \varepsilon with zero-mean noise, and f^D\hat f_D is a model fit on a random training set DD. Derive the expected squared error at a fixed input xx and show how it splits into noise, squared bias and variance.

What a Strong Answer Covers Guidance

  • The data model and assumptions, including that the test noise is independent of the training set.
  • What the expectation is taken over, and that xx is held fixed.
  • Both add-and-subtract steps, with a reason each cross term has zero expectation.
  • The three final terms, named and interpreted, and which one no model can reduce.
  • The connection to E[Z2]=Var(Z)+(E[Z])2\mathbb{E}[Z^2] = \mathrm{Var}(Z) + (\mathbb{E}[Z])^2 .

Follow-up Questions Guidance

  • Why does this decomposition not carry over directly to 0-1 loss or log loss?
  • How would you estimate the bias and variance terms for a real model when the true function is unknown?
  • How does averaging over the input distribution change what each term tells you?
  • How do bagging and ridge regularization move each term?