← Blog

Epoch-wise Bias–Variance Decomposition

Bias and variance are usually studied at the end of training. Here, we instead track how they evolve during optimization, one epoch at a time.

Suppose that we are training a model parameterized by θ\theta, and let θt\theta_t denote the parameters at step tt produced by the optimization algorithm of our choice. In machine learning, it is often helpful to decompose the error E(θ)E(\theta) as B2(θ)+V(θ)+N(θ)B^2(\theta)+V(\theta)+N(\theta), where BB represents the bias, VV the variance, and NN the noise (irreducible error). In most cases, the decomposition is performed at an optimal solution θ\theta^*—for instance, limtθt\lim_{t \to \infty}\theta_t, or an early-stopped version—to understand how bias and variance change with model complexity, model size, and related quantities. This has helped explain phenomena such as As model capacity grows, test error may first decrease, then increase near the interpolation threshold, and finally decrease again in the overparameterized regime.. It can also be useful to visualize how B(θt)B(\theta_t) and V(θt)V(\theta_t) evolve with tt, which can help explain For a fixed model, test error can decrease, rise around the time the training data are fitted, and then decrease again as training continues.. That is what we will study in this post.

Source An earlier version of these notes is available on HackMD.

Notations

  • X\mathcal{X} : domain set (input space)
  • Y\mathcal{Y} : label set (output space)
  • H\mathcal{H} : hypothesis class (class of possible models we can learn)

Definitions and preliminaries

Definition 1 Loss function. The loss function (t,y)\ell(t,y) takes two labels, produces a value between 00 and some constant M[0,]M\in[0,\infty], and measures the cost of predicting yy when the true value is tt.

 ⁣:Y×Y[0,M](t,y)(t,y)\begin{align*} \ell \colon \mathcal{Y} \times \mathcal{Y} &\to [0, M] \\ (t, y) &\mapsto \ell(t, y) \end{align*}

Examples include square loss (t,y)=(ty)2\ell(t,y)=(t-y)^2, absolute loss (t,y)=ty\ell(t,y)=|t-y|, and zero-one loss (t,y)=1{ty}\ell(t,y)=\mathbb{1}_{\{t\ne y\}}.

Definition 2 Training set. Let SS be a set of S|S| observations zi=(xi,ti)X×Yz_i=(x_i,t_i)\in\mathcal X\times\mathcal Y, where xiXx_i\in\mathcal X is a feature vector and tiYt_i\in\mathcal Y is the label of the ii-th sample. The observations are assumed to be i.i.d. means independent and identically distributed: every ziz_i follows the same distribution D\mathcal D, and observing one sample does not change the distribution of the others. draws from an unknown data distribution D\mathcal D.

S={z1,,zn}S = \{z_1, \cdots , z_n\}

Since training-set size is an important parameter of a learning problem, we assume below that all datasets have the same size nn.

Definition 3 Optimal prediction.

Let xx be random and let t=t(x)t=t(x) be either deterministic or random conditional on xx. The The joint distribution of an input and label equals the marginal distribution of the input multiplied by the conditional distribution of the label given that input. gives the optimal prediction at xx as

y(x)=argminyEtp(tx)[(t,y)].y^*(x)=\arg\min_y \mathbb E_{t\sim p(t\mid x)}[\ell(t,y)].

In the deterministic case, there exists tYt\in\mathcal Y such that p(tx)=1p(t\mid x)=1, and therefore y(x)=argminy(t,y)=ty^*(x)=\arg\min_y\ell(t,y)=t.

In the nondeterministic case:

  • Using square loss, we have
y(x)=argminyEtp(tx)[(ty)2]=argminyEtp(tx)[t22yt+y2]=argminy y22Etp(tx)[t]y+Etp(tx)[t2]=Etp(tx)[t]\begin{split} y^{*}(x) &= \arg\min_{y} \mathbb{E}_{t \sim p(t\mid x)}[(t - y)^2] \\ &= \arg\min_{y} \mathbb{E}_{t \sim p(t\mid x)}[t^2 - 2yt + y^2] \\ &= \arg\min_{y} \ y^2 - 2 \mathbb{E}_{t \sim p(t\mid x)} [t] y + \mathbb{E}_{t \sim p(t\mid x)} [t^2] \\ &= \mathbb{E}_{t \sim p(t\mid x)} [t] \end{split}

Thus the optimal prediction is the As a function of yy, the expected square loss is a convex quadratic. Its derivative is 2(yE[tx])2(y-\mathbb E[t\mid x]), which vanishes at y=E[tx]y=\mathbb E[t\mid x]. of p(tx)p(t\mid x). For example, suppose that, for a fixed xx, (x,1)(x,1) occurs with probability px[0,1]p_x\in[0,1] and (x,0)(x,0) occurs with probability 1px1-p_x:

t(x)={1,with probability px,0,with probability 1px.t(x)= \begin{cases} 1, & \text{with probability }p_x,\\ 0, & \text{with probability }1-p_x. \end{cases}

Then, using square loss, we have y(x)=pxy^*(x) = p_x.

  • Using absolute loss, we have
y(x)=argminyEtp(tx)[yt]=argminy 2yFtx(t)dty+Etp(tx)[t]+2limttFtx(t)=Ftx1(1/2)\begin{split} y^*(x) &= \arg\min_{y} \mathbb{E}_{t \sim p(t\mid x)}[|y - t|] \\ &= \arg\min_{y} \ 2 \int_{-\infty}^{y} F_{t\mid x}(t)dt - y + \mathbb{E}_{t \sim p(t\mid x)} [t] + 2\lim_{t \rightarrow - \infty} t F_{t\mid x}(t) \\ &= F_{t|x}^{-1}(1/2) \end{split}

where FtxF_{t\mid x} is the Ftx(u)=P(tux)F_{t\mid x}(u)=\mathbb P(t\le u\mid x). Its generalized inverse is Ftx1(q)=inf{u:Ftx(u)q}F_{t\mid x}^{-1}(q)=\inf\{u:F_{t\mid x}(u)\ge q\}, which remains meaningful for discrete distributions.. Thus y(x)y^*(x) is a median of p(tx)p(t\mid x).

The last line follows because y2Ftx(y)1y\mapsto 2F_{t\mid x}(y)-1 is the derivative of the function

y2yFtx(t)dty+Etp(tx)[t]+2limttFtx(t),y \mapsto 2 \int_{-\infty}^{y} F_{t\mid x}(t)dt - y + \mathbb{E}_{t \sim p(t\mid x)} [t] +2\lim_{t \rightarrow - \infty} t F_{t\mid x}(t),

which therefore reaches its minimum at a median, where y=Ftx1(1/2)y=F_{t\mid x}^{-1}(1/2).

Derivation of the absolute-loss identity

The second line follows from

Etp(tx)[yt]=Etp(tx)[(yt)I[yt](yt)I[y<t]]=Etp(tx)[(yt)I[yt](yt)(1I[yt])]=Etp(tx)[(yt)(2I[yt]1)]=Etp(tx)[2yI[yt]y2tI[yt]+t]=2yEtp(tx)[I[yt]]yEtp(tx)[1]2Etp(tx)[tI[yt]]+Etp(tx)[t]=2yFtx(y)y2[,y]t dFtx(t)+Etp(tx)[t]=2yFtx(y)y2([tFtx(t)]y[,y]Ftx(t)dt)+Etp(tx)[t]=2yFtx(y)y2(yFtx(y)limttFtx(t)yFtx(t)dt)+Etp(tx)[t]=2yFtx(y)y2yFtx(y)+2limttFtx(t)+2yFtx(t)dt+Etp(tx)[t]=2yFtx(t)dty+Etp(tx)[t]+2limttFtx(t)\begin{split} \mathbb{E}_{t \sim p(t\mid x)}[|y - t|] &= \mathbb{E}_{t \sim p(t\mid x)}\Big[(y - t) \mathbb{I}[y\ge t] - (y - t) \mathbb{I}[y<t] \Big] \\ &= \mathbb{E}_{t \sim p(t\mid x)}\Big[(y - t) \mathbb{I}[y\ge t] - (y - t) (1-\mathbb{I}[y\ge t]) \Big] \\ &= \mathbb{E}_{t \sim p(t\mid x)}\Big[(y - t) (2\mathbb{I}[y\ge t] - 1) \Big] \\ &= \mathbb{E}_{t \sim p(t\mid x)}\Big[2y \mathbb{I}[y\ge t] - y - 2 t \mathbb{I}[y\ge t] + t \Big] \\ &= 2y\mathbb{E}_{t \sim p(t\mid x)}\big[\mathbb{I}[y\ge t] \big] - y\mathbb{E}_{t \sim p(t\mid x)}[1] - 2\mathbb{E}_{t \sim p(t\mid x)}\big[t\mathbb{I}[y\ge t] \big] + \mathbb{E}_{t \sim p(t\mid x)}[t] \\ &= 2yF_{t\mid x}(y) - y - 2 \int_{[-\infty, y]} t \ dF_{t\mid x}(t) + \mathbb{E}_{t \sim p(t\mid x)}[t] \\ &= 2yF_{t\mid x}(y) - y - 2 \Big( [t F_{t\mid x}(t)]_{-\infty}^{y} - \int_{[-\infty, y]} F_{t\mid x} (t)dt \Big) + \mathbb{E}_{t \sim p(t\mid x)}[t] \\ &= 2yF_{t\mid x}(y) - y - 2 \Big( y F_{t\mid x}(y) - \lim_{t \rightarrow - \infty} t F_{t\mid x}(t) - \int_{-\infty}^y F_{t\mid x}(t)dt \Big) + \mathbb{E}_{t \sim p(t\mid x)}[t] \\ &= 2yF_{t\mid x}(y) - y - 2yF_{t\mid x}(y) + 2\lim_{t \rightarrow - \infty} t F_{t\mid x}(t) + 2\int_{-\infty}^y F_{t\mid x}(t)dt + \mathbb{E}_{t \sim p(t\mid x)}[t] \\ &= 2\int_{-\infty}^y F_{t\mid x}(t)dt - y + \mathbb{E}_{t \sim p(t\mid x)}[t] + 2\lim_{t \rightarrow - \infty} t F_{t\mid x}(t) \end{split}

For the Bernoulli example above, Ftx(u)=(1px)1{0u<1}+1{1u}F_{t\mid x}(u)=(1-p_x)\mathbb{1}_{\{0\le u<1\}}+\mathbb{1}_{\{1\le u\}}, so y(x)=1{1px<1/2}+λ1{1px=1/2}=1{px>1/2}+λ1{px=1/2},λ[0,1].y^*(x) = \mathbb{1}_{\{1-p_x<1/2\}}+\lambda\mathbb{1}_{\{1-p_x=1/2\}} = \mathbb{1}_{\{p_x>1/2\}}+\lambda\mathbb{1}_{\{p_x=1/2\}},\qquad \lambda\in[0,1].

  • Using zero-one loss, we have
y(x)=argminyEtp(tx)[I[ty]]=argminyEtp(tx)[1I[t=y]]=argminy1Etp(tx)[I[t=y]]=argmaxyEtp(tx)[I[t=y]]=argmaxtp(tx)=argmaxtp(t,x)\begin{split} y^*(x) &= \arg\min_{y} \mathbb{E}_{t \sim p(t\mid x)}[\mathbb{I}[t\ne y]] \\ &= \arg\min_{y} \mathbb{E}_{t \sim p(t\mid x)}[1-\mathbb{I}[t=y]] \\ &= \arg\min_{y} 1 - \mathbb{E}_{t \sim p(t\mid x)}[\mathbb{I}[t=y]] \\ &= \arg\max_{y} \mathbb{E}_{t \sim p(t\mid x)}[\mathbb{I}[t=y]] \\ &= \arg\max_{t} p(t\mid x) = \arg\max_{t} p(t,x) \end{split}

That is the A mode is any label with maximal conditional probability p(tx)p(t\mid x). Predicting it minimizes the probability of misclassification under zero-one loss.. For the same Bernoulli example, we have

y(x)=argminy pxI[y1]+(1px)I[y0]=I[px1px]=I[px1/2]\begin{split} y^*(x) &= \arg\min_y \ p_x\mathbb{I}[y\ne 1] + (1-p_x)\mathbb{I}[y\ne 0] \\ &= \mathbb{I}[p_x\ge 1-p_x] \\ &= \mathbb{I}[p_x\ge 1/2] \end{split}

Definition 4 Learning algorithm. A learning algorithm is a map A:(X×Y)nH\mathcal A:(\mathcal X\times\mathcal Y)^n\to\mathcal H. It takes a dataset S(X×Y)nS\in(\mathcal X\times\mathcal Y)^n containing nn samples and returns a model h=A(S)Hh=\mathcal A(S)\in\mathcal H.

The optimal model satisfies f(x)=y(x)f(x)=y^*(x) for every xx. Under zero-one loss, this is the The Bayes classifier predicts a most probable class conditional on xx. The smallest classification error it can attain is the Bayes rate; this is the irreducible classification error induced by class overlap or label noise.. In the binary example above, it is f(x)=1{P(t=1x)1/2}f(x)=\mathbb{1}_{\{\mathbb P(t=1\mid x)\ge 1/2\}}.

Definition 5 True risk. Given hHh\in\mathcal H,

R[h]=E(x,t)D[(t,h(x))]R[h] = \mathbb{E}_{(x,t) \sim \mathcal{D}}[ \ell(t, h(x))]

Definition 6 Empirical risk. For hHh\in\mathcal H and S={(x1,t1),,(xn,tn)}S=\{(x_1,t_1),\ldots,(x_n,t_n)\},

R^S[h]=1ni=1n(ti,h(xi))\hat{R}_S[h] =\frac{1}{n} \sum_{i=1}^n \ell(t_i, h(x_i))

The essential task of supervised learning is to obtain good performance on unseen data by adjusting hh using one sampled training set SS. The True risk averages over the unknown population distribution D\mathcal D; empirical risk averages over the finite observed training set. Generalization concerns how well the latter controls the former.. We recall them mainly to make the dependence h=A(S)h=\mathcal A(S) explicit.

Definition 7 Expected loss at an input.

Since the same learner A\mathcal A generally produces different models hh for different training sets SS, the loss (t,h(x))\ell(t,h(x)) depends on SS through h=A(S)h=\mathcal A(S). We expose this dependency by averaging over training sets.

Let DnD_n be a collection of training sets of size nn, let y^n(x)\hat y_n(x) denote the prediction at xx obtained by applying the learner to a sampled training set, and let Yn(x)={A(S)(x):SDn}Y_n(x)=\{\mathcal A(S)(x):S\in D_n\} be the A multiset keeps multiplicity: the same numerical prediction appears several times when several training sets produce it. Equivalently, one may regard Yn(x)Y_n(x) as the empirical distribution induced by sampling SS from DnD_n..

The quantity of interest is the expected loss

En(x)=EDn, tp(tx)[(t,y^n(x))]=EyYn(x), tp(tx)[(t,y)]E_n(x) = \mathbb{E}_{D_n, \ t \sim p(t\mid x)}[\ell(t, \hat{y}_n(x))] = \mathbb{E}_{y \sim Y_n(x), \ t \sim p(t\mid x)}[\ell(t, y)]

Our objective is to decompose En(x)E_n(x) into three terms: bias, variance, and noise (irreducible error). A standard decomposition exists for square loss, and several alternatives have been proposed for zero-one loss.

Definition 8 Main prediction. For a loss function \ell and a collection of training sets DnD_n, the main prediction is

y,Dn(x)=argminyEDn[(y^n(x),y)]=argminyEyYn(x)[(y,y)]y^{\ell, D_n} (x) = \arg\min_{y'} \mathbb{E}_{D_n}[\ell(\hat{y}_n(x), y')] = \arg\min_{y'} \mathbb{E}_{y \sim Y_n(x)}[\ell(y, y')]

In words, the main prediction minimizes its average loss relative to all predictions in Yn(x)Y_n(x). It is the prediction that “differs least” from the learner’s possible predictions according to \ell, and therefore describes their central tendency.

Remark The main prediction need not belong to Yn(x)Y_n(x). For example, the mean of finitely many predictions can lie strictly between all observed values.

Theorem 1 Under square loss, the main prediction is the mean of Yn(x)Y_n(x); under absolute loss, it is a median; and under zero-one loss, it is a mode (a most frequent prediction).

Proof for the mean, median, and mode
  • Under square loss, the main prediction is the mean because
y,Dn(x)=argminyEyYn(x)[(yy)2]=argminy y22EyYn(x)[y]y+EyYn(x)[y2]=EyYn(x)[y]\begin{split} y^{\ell, D_n}(x) &= \arg\min_{y'} \mathbb{E}_{y \sim Y_n(x)}[(y - y')^2] \\ &= \arg\min_{y'} \ {y'}^2 - 2 \mathbb{E}_{y \sim Y_n(x)} [y] y' + \mathbb{E}_{y \sim Y_n(x)} [y^2] \\ &= \mathbb{E}_{y \sim Y_n(x)}[y] \end{split}
  • Under absolute loss, it is a median because
y,Dn(x)=argminyEyYn(x)[yy]=argminy 2yFYn(x)(y)dyy+EyYn(x)[y]+2limyyFYn(x)(y)=FYn(x)1(1/2)\begin{split} y^{\ell, D_n}(x) &= \arg\min_{y'} \mathbb{E}_{y \sim Y_n(x)}[|y' - y|] \\ &= \arg\min_{y'} \ 2 \int_{-\infty}^{y'} F_{Y_n(x)}(y)dy - y' + \mathbb{E}_{y \sim Y_n(x)} [y] + 2\lim_{y \rightarrow - \infty} y F_{Y_n(x)}(y) \\ &= F_{Y_n(x)}^{-1}(1/2) \end{split}

where FYn(x)F_{Y_n(x)} is the cumulative distribution function of yYn(x)y\sim Y_n(x). This is the same absolute-loss derivation used in Definition 3.

  • Under zero-one loss, it is a mode because
y,Dn(x)=argminyEyYn(x)[I[yy]]=argminyEyYn(x)[1I[y=y]]=argminy1EyYn(x)[I[y=y]]=argmaxyEyYn(x)[I[y=y]]=argmaxyfYn(x)(y)\begin{split} y^{\ell, D_n}(x) &= \arg\min_{y'} \mathbb{E}_{y \sim Y_n(x)}[\mathbb{I}[y\ne y']] \\ &= \arg\min_{y'} \mathbb{E}_{y \sim Y_n(x)}[1-\mathbb{I}[y=y']] \\ &= \arg\min_{y'} 1 - \mathbb{E}_{y \sim Y_n(x)}[\mathbb{I}[y=y']] \\ &= \arg\max_{y'} \mathbb{E}_{y \sim Y_n(x)}[\mathbb{I}[y=y']] \\ &= \arg\max_{y'} f_{Y_n(x)} (y') \end{split}

where fYn(x)f_{Y_n(x)} is the probability-mass function when Yn(x)Y_n(x) is discrete, or a density when it is continuous.

Definition 9 Bias, variance, and noise. For an input xx, define

B2(x)=(y(x),y,Dn(x))V(x)=EDn[(y,Dn(x),yn(x))]=EyYn(x)[(y,Dn(x),y)]N(x)=Etp(tx)[(t,y(x))]\begin{gathered} B^2(x) = \ell( y^*(x), y^{\ell, D_n}(x)) \\ V(x) = \mathbb{E}_{D_n}[\ell( y^{\ell, D_n}(x), y_n(x))] = \mathbb{E}_{y \sim Y_n(x)}[\ell( y^{\ell, D_n}(x), y )] \\ N(x) = \mathbb{E}_{t \sim p(t\mid x)}[\ell(t, y^*(x))] \end{gathered}

In words, the square bias is the loss of the main prediction relative to the optimal prediction; the variance is the average loss of individual learned predictions relative to the main prediction; and the noise is the unavoidable component, independent of the learning algorithm. In the deterministic case, N(x)=(t(x),t(x))N(x)=\ell(t(x),t(x)) for every xx.

Bias and variance may be averaged over all examples, in which case we will refer to them as average square bias

Exp(x)[B2(x)]\mathbb{E}_{x \sim p(x)}[B^2(x)]

and average variance

Exp(x)[V(x)].\mathbb{E}_{x \sim p(x)}[V(x)].

The average noise is

Exp(x)[N(x)]=E(x,t)p(x,t)[(t,y(x))]\mathbb{E}_{x \sim p(x)}[N(x)] = \mathbb{E}_{(x,t) \sim p(x,t)}[\ell(t, y^*(x))]

Theorem 2 For square loss (t,y)=(ty)2\ell(t,y)=(t-y)^2,

V(x)=EyYn(x)[y2](y,Dn(x))2 and N(x)=Etp(tx)[t2](y(x))2V(x) = \mathbb{E}_{y \sim Y_n(x)}[y^2] - ( y^{\ell, D_n}(x))^2 \text{ and } N(x) = \mathbb{E}_{t \sim p(t\mid x)}[t^2] - (y^*(x))^2
Proof of the variance and noise identities V(x)=EyYn(x)[(y,Dn(x)y)2]=EyYn(x)[(y,Dn(x))2]2y,Dn(x)EyYn(x)[y]+EyYn(x)[y2]=(y,Dn(x))22(y,Dn(x))2+EyYn(x)[y2]=EyYn(x)[y2](y,Dn(x))2\begin{split} V(x) &= \mathbb{E}_{y \sim Y_n(x)}[( y^{\ell, D_n}(x) - y)^2] \\&= \mathbb{E}_{y \sim Y_n(x)}[( y^{\ell, D_n}(x))^2] - 2 y^{\ell, D_n}(x) \mathbb{E}_{y \sim Y_n(x)}[y] + \mathbb{E}_{y \sim Y_n(x)}[y^2] \\&= ( y^{\ell, D_n}(x))^2 - 2 ( y^{\ell, D_n}(x))^2 + \mathbb{E}_{y \sim Y_n(x)}[y^2] \\&= \mathbb{E}_{y \sim Y_n(x)}[y^2] - ( y^{\ell, D_n}(x))^2 \end{split} N(x)=Etp(tx)[(ty(x))2]=Etp(tx)[t2]2y(x)Etp(tx)[t]+Etp(tx)[(y(x))2]=Etp(tx)[t2]2(y(x))2+(y(x))2=Etp(tx)[t2](y(x))2\begin{split} N(x) &= \mathbb{E}_{t \sim p(t\mid x)}[(t - y^*(x))^2] \\&= \mathbb{E}_{t \sim p(t\mid x)}[t^2] - 2 y^*(x) \mathbb{E}_{t \sim p(t\mid x)}[t] + \mathbb{E}_{t \sim p(t\mid x)}[(y^*(x))^2] \\&= \mathbb{E}_{t \sim p(t\mid x)}[t^2] - 2 (y^*(x))^2 + (y^*(x))^2 \\&= \mathbb{E}_{t \sim p(t\mid x)}[t^2] - (y^*(x))^2 \end{split}

Bias-variance decomposition

For a given loss function \ell, we seek two constants c1(x,)c_1(x,\ell) and c2(x,)c_2(x,\ell) such that

En(x)= B2(x)+c1(x,) V(x)+c2(x,) N(x)E_n(x) = \ B^2(x) + c_1(x, \ell) \ V(x) + c_2(x, \ell) \ N(x)

Theorem 3 For square loss (t,y)=(ty)2\ell(t,y)=(t-y)^2, c1(x,)=c2(x,)=1c_1(x,\ell)=c_2(x,\ell)=1.

Proof of the square-loss decomposition En(x)=EyYn(x),tp(tx)[(ty)2]=EyYn(x),tp(tx)[(ty(x)+y(x)y)2]=Etp(tx)[(ty(x))2]+2(Etp(tx)[t]y(x))(y(x)EyYn(x)[y])+EyYn(x)[(y(x)y)2]=N(x)+2×0×(y(x)EyYn(x)[y])+EyYn(x)[(y(x)y,Dn(x)+y,Dn(x)y)2]=N(x)+(y(x)y,Dn(x))2+2(y(x)y,Dn(x))(y,Dn(x)EyYn(x)[y])+EyYn(x)[(y,Dn(x)y)2]=N(x)+B2(x)+2(y(x)y,Dn(x))×0+V(x)=B2(x)+V(x)+N(x)\begin{split} E_n(x) &= \mathbb{E}_{y \sim Y_n(x),\,t \sim p(t\mid x)}[(t-y)^2] \\ &= \mathbb{E}_{y \sim Y_n(x),\,t \sim p(t\mid x)}[(t-y^*(x)+y^*(x)-y)^2] \\ &= \mathbb{E}_{t \sim p(t\mid x)}[(t-y^*(x))^2] + 2\bigl(\mathbb{E}_{t \sim p(t\mid x)}[t]-y^*(x)\bigr)\bigl(y^*(x)-\mathbb{E}_{y \sim Y_n(x)}[y]\bigr) + \mathbb{E}_{y \sim Y_n(x)}[(y^*(x)-y)^2] \\ & = N(x) + 2\times0\times(y^*(x) - \mathbb{E}_{y \sim Y_n(x)}[y]) + \mathbb{E}_{y \sim Y_n(x)}[(y^*(x) - y^{\ell, D_n}(x) + y^{\ell, D_n}(x) - y)^2] \\ & = N(x) + (y^*(x) - y^{\ell, D_n}(x))^2 + 2(y^*(x) - y^{\ell, D_n}(x))(y^{\ell, D_n}(x) - \mathbb{E}_{y \sim Y_n(x)}[y]) + \mathbb{E}_{y \sim Y_n(x)}[(y^{\ell, D_n}(x) - y)^2] \\ & = N(x) + B^2(x) + 2(y^*(x) - y^{\ell, D_n}(x))\times 0 + V(x) \\ & = B^2(x)+V(x)+N(x) \end{split}

Let PDn(x)=P[y(x)Yn(x)]\mathbb{P}_{D_n}(x) = \mathbb{P}[y^*(x) \in Y_n(x)] be the probability over training sets in DnD_n that the learner predicts the optimal class for xx.

Theorem 4 For zero-one loss (t,y)=1{ty}\ell(t,y)=\mathbb{1}_{\{t\ne y\}} in binary classification, c1(x,)=2PDn(x)1c_1(x,\ell)=2\mathbb P_{D_n}(x)-1 and c2(x,)=21{y,Dn(x)=y(x)}1c_2(x,\ell)=2\mathbb{1}_{\{y^{\ell,D_n}(x)=y^*(x)\}}-1.

The proof is given by Pedro Domingos, “A Unified Bias-Variance Decomposition for Zero-One and Squared Loss,” AAAI 2000, pp. 564–569..

The same paper treats multiclass zero-one loss and absolute loss (t,y)=ty\ell(t,y)=|t-y|.

Application: teacher–student setup

Work in progress The teacher–student application remains in the earlier HackMD version while I verify and format its derivation for this post.

References

Cite this post

If you would like to cite this post, you can use the following BibTeX entry:

@misc{tikengnotsawo2023biasvarianceepoch,
  author = {Tikeng Notsawo, Pascal Jr.},
  title = {{Epoch-wise Bias–Variance Decomposition}},
  year = {2023},
  month = may,
  url = {https://tikquuss.github.io/blog/bias-variance-epoch/},
  note = {Blog post}
}