Tutorials › Statistical Learning (Graduate) › Squared-Loss Decomposition for Aggregated Regression

Exponential Weights and Convex Aggregation · Tutorial 330 of 989

Squared-Loss Decomposition for Aggregated Regression

Learn to derive and interpret the exact variance-reduction term in squared-loss regression aggregation.

Advanced 10 min read

What You'll Learn

  • Define a weighted mean prediction and its weighted prediction variance.
  • Derive the pointwise squared-loss identity for any response and simplex weights.
  • Extend the identity to empirical and population squared-error risk.
  • Identify exactly when aggregation strictly reduces loss relative to the weighted component losses.
  • Distinguish prediction variance reduction from irreducible response noise.

Why Squared Loss Gives an Exact Aggregation Identity

When several regression predictors are combined, their weighted mean is itself a prediction. Under squared loss, its performance has a particularly precise relationship to the performances of the component predictors: the difference is exactly the weighted variance of their predictions. This is stronger than a general statement that averaging can help. It identifies the amount of the improvement, and the predictions for which the improvement occurs.

The identity is pointwise: it holds for every response value, every input, and every set of nonnegative weights that sum to one. It therefore does not require a probability model, independent predictors, or a correctly specified regression function. Probability and sampling assumptions enter only when we use the identity to compare expected risks.

Definition of the Aggregate and Its Prediction Variance

Let \(f_1,\ldots,f_M\) be real-valued regression predictors, evaluated at an input \(x\). Let \(w_1,\ldots,w_M\) be weights satisfying \(w_j\geq 0\) and \(\sum_{j=1}^M w_j=1\). The weights may be fixed in advance or selected using data; the algebra below applies once their values are given.

Definition: The weighted mean prediction at \(x\) is \(\bar f(x)=\sum_{j=1}^M w_j f_j(x)\). The weighted prediction variance at \(x\) is \(V_w(x)=\sum_{j=1}^M w_j\bigl(f_j(x)-\bar f(x)\bigr)^2\). It measures the weighted dispersion of the component predictions around their aggregate.

The term “variance” here refers to the variance of the finite distribution that places mass \(w_j\) on prediction \(f_j(x)\). In particular, it is nonnegative and is zero exactly when every predictor with positive weight gives the same prediction at \(x\). It is not the variance of the response \(Y\), nor does it describe uncertainty in the outcome.

The Pointwise Squared-Loss Identity

For a response value \(y\), squared loss for a prediction \(a\) is \((y-a)^2\). The central identity separates the weighted average of the component losses into the loss of the aggregate and a nonnegative dispersion term.

Theorem: For any real \(y\), predictions \(f_1(x),\ldots,f_M(x)\), and weights \(w_j\geq 0\) summing to one, $$ \sum_{j=1}^M w_j\bigl(y-f_j(x)\bigr)^2 = \bigl(y-\bar f(x)\bigr)^2+V_w(x). $$ Equivalently, the aggregate's squared loss is the weighted mean of the component squared losses minus the weighted prediction variance.

To prove the identity, write each prediction as its weighted mean plus its deviation from that mean. Expanding the squared error produces a cross term, but that term vanishes because the weighted deviations sum to zero.

1
Center each prediction.
Write \(f_j(x)=\bar f(x)+\bigl(f_j(x)-\bar f(x)\bigr)\), so \(y-f_j(x)=\bigl(y-\bar f(x)\bigr)-\bigl(f_j(x)-\bar f(x)\bigr)\).
2
Expand and weight.
Squaring and summing with weights gives $$ \sum_{j=1}^M w_j(y-f_j(x))^2 =(y-\bar f(x))^2\sum_{j=1}^M w_j -2(y-\bar f(x))\sum_{j=1}^M w_j(f_j(x)-\bar f(x)) +\sum_{j=1}^M w_j(f_j(x)-\bar f(x))^2. $$
3
Use the weight and centering identities.
The first sum is \(1\), and the middle sum is \(\sum_j w_j f_j(x)-\bar f(x)\sum_j w_j=\bar f(x)-\bar f(x)=0\). The last sum is \(V_w(x)\), proving the result. \(\square\)

The equality also shows exactly when the aggregate improves on the weighted component losses. Since \(V_w(x)\geq 0\), the loss of \(\bar f(x)\) is never larger than the weighted mean component loss at that same input and response. The improvement is strict if and only if the positively weighted predictions are not all equal.

Worked Example: Computing the Pointwise Reduction

At an input \(x\), suppose the response is \(y=3\). Three predictors give \(f_1(x)=1\), \(f_2(x)=2\), and \(f_3(x)=4\), with weights \(w_1=0.2\), \(w_2=0.5\), and \(w_3=0.3\). The weights are nonnegative and sum to \(0.2+0.5+0.3=1\).

The aggregate prediction is \(\bar f(x)=0.2(1)+0.5(2)+0.3(4)=0.2+1+1.2=2.4\). Its squared loss is \((3-2.4)^2=0.6^2=0.36\).

The weighted component loss is \(0.2(3-1)^2+0.5(3-2)^2+0.3(3-4)^2 =0.2(4)+0.5(1)+0.3(1)=0.8+0.5+0.3=1.6\).

The weighted prediction variance is \(0.2(1-2.4)^2+0.5(2-2.4)^2+0.3(4-2.4)^2 =0.2(1.96)+0.5(0.16)+0.3(2.56)=0.392+0.08+0.768=1.24\). Thus \(0.36+1.24=1.6\), as the identity requires. The loss reduction is exactly \(1.24\).

Empirical and Population Risk

The pointwise result immediately yields an empirical identity. For observations \((X_i,Y_i)\), \(i=1,\ldots,n\), define the empirical squared-error risk of a predictor \(f\) by \(R_n(f)=n^{-1}\sum_{i=1}^n(Y_i-f(X_i))^2\). If the weights are the same across observations, the pointwise identity can be applied separately to each row and then averaged.

Corollary: For a fixed set of simplex weights and \(\bar f=\sum_j w_j f_j\), $$ \sum_{j=1}^M w_j R_n(f_j) = R_n(\bar f) +\frac{1}{n}\sum_{i=1}^n\sum_{j=1}^M w_j\bigl(f_j(X_i)-\bar f(X_i)\bigr)^2. $$

The same reasoning applies to expected risk. Let \((X,Y)\) have a joint distribution, and define \(R(f)=E[(Y-f(X))^2]\). Suppose \(E[Y^2]<\infty\) and \(E[f_j(X)^2]<\infty\) for each \(j\). Then each squared error has finite expectation, because \((Y-f_j(X))^2\leq 2Y^2+2f_j(X)^2\). The finite pointwise identity can therefore be integrated term by term.

Theorem: Under these square-integrability conditions, for fixed simplex weights, $$ \sum_{j=1}^M w_j R(f_j) = R(\bar f)+E\left[\sum_{j=1}^M w_j\bigl(f_j(X)-\bar f(X)\bigr)^2\right]. $$ Consequently, the aggregate risk is no greater than the weighted mean of the component risks. The inequality is strict exactly when the weighted prediction variance is positive with positive probability.

For the strictness statement, the expectation of a nonnegative random variable is positive if and only if that variable is positive with positive probability. Thus, if the component predictions differ on a set of inputs that occurs with positive probability, and the differing predictions carry positive weight, the aggregate has strictly smaller risk than their weighted mean risk. This does not imply that the aggregate beats the best individual predictor: the weighted mean risk itself can exceed the risk of the best component.

Worked Example: Verifying an Empirical Risk Identity

Consider three observations with responses \(Y=(1,2,1)\). Predictor \(f_1\) gives predictions \((0,1,2)\), and predictor \(f_2\) gives \((2,1,0)\). Use equal weights \(w_1=w_2=0.5\).

The aggregate predictions are \((1,1,1)\). Its squared errors are \((1-1)^2=0\), \((2-1)^2=1\), and \((1-1)^2=0\), so \(R_n(\bar f)=(0+1+0)/3=1/3\).

For \(f_1\), the squared errors are \((1-0)^2=1\), \((2-1)^2=1\), and \((1-2)^2=1\), giving \(R_n(f_1)=1\). For \(f_2\), they are \((1-2)^2=1\), \((2-1)^2=1\), and \((1-0)^2=1\), giving \(R_n(f_2)=1\). The weighted component risk is therefore \(0.5(1)+0.5(1)=1\).

At the first input, the component predictions are 0 and 2, so their weighted prediction variance is \(0.5(0-1)^2+0.5(2-1)^2=1\). At the second input, both predict 1, so the variance is 0. At the third input, the predictions are 2 and 0, giving variance \(0.5(2-1)^2+0.5(0-1)^2=1\). The average variance is \((1+0+1)/3=2/3\), and \(1/3+2/3=1\), as required.

Separating Prediction Dispersion from Response Noise

The reduction term concerns disagreement among the predictors, not the randomness of the response around its conditional mean. To make that distinction precise, suppose \(E[Y^2]<\infty\), and write \(m(X)=E[Y\mid X]\). For any square-integrable predictor \(g(X)\), conditioning on \(X\) gives $$ E[(Y-g(X))^2\mid X] = \operatorname{Var}(Y\mid X)+(m(X)-g(X))^2. $$

Indeed, write \(Y-g(X)=(Y-m(X))+(m(X)-g(X))\), square, and condition on \(X\). The cross term has conditional expectation zero because \(E[Y-m(X)\mid X]=0\); the squared first term has conditional expectation \(\operatorname{Var}(Y\mid X)\). The remaining term is fixed given \(X\).

Worked Example: Aggregation Does Not Remove Outcome Noise

At a particular input \(x\), suppose the conditional mean of \(Y\) is 2 and its conditional variance is 3. Two predictors output 0 and 4, each with weight 0.5, so the aggregate predicts \(\bar f(x)=0.5(0)+0.5(4)=2\).

Using the conditional risk formula, the aggregate's conditional squared risk is \(3+(2-2)^2=3\). The conditional risk of the first predictor is \(3+(2-0)^2=3+4=7\), and that of the second is \(3+(2-4)^2=3+4=7\). Their weighted mean conditional risk is \(0.5(7)+0.5(7)=7\).

The prediction variance is \(0.5(0-2)^2+0.5(4-2)^2=0.5(4)+0.5(4)=4\). Hence \(7=3+4\). Aggregation removes the four units attributable to disagreement between these predictions, but the three units of conditional response variance remain.

Interpretation and a Common Mistake

This identity is useful whenever a regression procedure averages candidate predictions. It gives an exact diagnostic for the benefit attributable to averaging: at each input, inspect the weighted spread of the candidate predictions. Large disagreement creates a large gap between weighted component loss and aggregate loss; agreement leaves little or no gap. The identity itself does not say how to choose weights, guarantee a small risk, or establish that the aggregate is close to the best possible predictor.

If the weights are estimated from a training sample, the algebra remains valid for the realized weights and predictions. It can also be applied to a new test observation conditional on the training data. The exact comparison is between the aggregate loss and the weighted losses of the same component predictions, evaluated at the same response and input.

  • Common mistake: treating the aggregate loss as the weighted mean component loss. That omits the prediction-variance term. The correct identity subtracts \(V_w(x)\) from the weighted component loss to obtain the aggregate loss.
  • Common mistake: concluding that averaging always beats every component. The identity compares the aggregate with the weighted average of component losses, not with their minimum. For example, a poorly chosen set of weights can give a weighted mean risk above the risk of one component.
  • Common mistake: interpreting prediction variance as response noise. It measures disagreement among the predictions at a fixed input. Conditional response variance is a different quantity and remains even when the aggregate prediction equals the conditional mean.
Key takeaway: For squared loss, weighted component loss equals aggregate loss plus weighted prediction variance. The variance term is the exact, nonnegative reduction from replacing the separate predictions by their weighted mean.

Check Your Understanding

Use the identity to answer each question; distinguish pointwise loss, risk, and response noise.

  1. With two equally weighted predictions \(a\) and \(b\) at an input, what is their weighted prediction variance in terms of \(a-b\)?
  2. What conditions on the weights are needed for the stated identity, and where are they used in the proof?
  3. When is the aggregate's pointwise squared loss strictly less than the weighted mean component loss?
  4. Why does the risk identity not imply that the aggregate has lower risk than the best component predictor?
  5. If \(E[Y\mid X=x]=\bar f(x)\) but \(\operatorname{Var}(Y\mid X=x)>0\), what is the aggregate's conditional squared risk?
Clinical Biostats