Tutorials › Statistical Learning (Graduate) › Risk Penalties From Weight–Error Dependence

Ensemble Risk and Diversity · Tutorial 883 of 989

Risk Penalties From Weight–Error Dependence

Learn to decompose ensemble risk when weights and prediction errors are dependent, and see why the resulting change can either increase or decrease risk.

Advanced 10 min read

What You'll Learn

  • Define ensemble risk for fixed and random weights using prediction-error second moments.
  • Derive an exact decomposition of adaptive-weight risk around the mean weights.
  • Identify the weight–error interaction term and the nonnegative weight-variability term.
  • Explain when random weights independent of test errors add risk relative to their mean weights.
  • Calculate examples where error-dependent weights increase risk and where idealized adaptive weights reduce it.
  • Distinguish dependence on observed error information from dependence on future evaluation errors.

Why Weight–Error Dependence Changes Risk

An ensemble combines predictions, but its risk depends on more than the average weight assigned to each member. If weights vary across prediction cases, the weights may systematically be large when particular errors are large, or small when they are large. That dependence changes the squared error of the aggregate. It can increase risk, but it can also reduce it.

The distinction is between fixed-weight aggregation, where the same weight vector is used for every case, and adaptive-weight aggregation, where the weight vector is random and statistically related to the prediction errors being evaluated. The goal here is to derive the risk terms created by that relationship. We use squared prediction loss and do not require the individual errors to have mean zero.

Definition: Let \(e=(e_1,\ldots,e_m)^\top\) be the vector of prediction errors for \(m\) ensemble members on a randomly drawn evaluation case. For a weight vector \(W=(W_1,\ldots,W_m)^\top\), the aggregate error is \(W^\top e\), and its squared-error risk is \(R(W)=E[(W^\top e)^2]\). The weights may be fixed or random. Unless stated otherwise, assume the expectations displayed below are finite.

Write \(M=E[ee^\top]\), the error second-moment matrix. For a fixed vector \(w\), the risk is

$$ R(w)=E[(w^\top e)^2]=w^\top M w. $$

If the errors have mean zero, \(M\) is their covariance matrix. If not, it includes both covariance and mean-error contributions. Using the second-moment matrix keeps the fixed-weight formula valid without a centering assumption.

An Exact Decomposition for Random Weights

For adaptive weights, replacing \(W\) by its mean \(\mu=E[W]\) does not generally preserve risk. The exact difference has two parts: an interaction between the mean-weight aggregate error and the weight fluctuation, and a squared fluctuation term.

Theorem: Let \(W\) and \(e\) be jointly distributed, with finite expectations in the expressions below. Set \(\mu=E[W]\) and \(\Delta=W-\mu\). Then
$$ R(W)=\mu^\top M\mu +2\mu^\top E[ee^\top\Delta] +E[(\Delta^\top e)^2]. $$
Consequently, the change from using the fixed mean weights \(\mu\) is
$$ R(W)-R(\mu) =2\mu^\top E[ee^\top\Delta]+E[(\Delta^\top e)^2]. $$
The last term is nonnegative; the interaction term can have either sign.

Proof. Since \(W=\mu+\Delta\), the aggregate error satisfies \(W^\top e=\mu^\top e+\Delta^\top e\). Squaring and taking expectations gives

$$ \begin{aligned} R(W) &=E[(\mu^\top e)^2] +2E[(\mu^\top e)(\Delta^\top e)] +E[(\Delta^\top e)^2]\\ &=\mu^\top E[ee^\top]\mu +2\mu^\top E[ee^\top\Delta] +E[(\Delta^\top e)^2]. \end{aligned} $$

Here \((\mu^\top e)(\Delta^\top e)=\mu^\top ee^\top\Delta\). The first term is \(R(\mu)\), and the last term is an expectation of a square, so it is nonnegative. Subtracting \(R(\mu)\) proves the risk-difference identity. \(\square\)

The interaction term is the part that a simple “random weights add variance” argument misses. It is not generally zero just because \(E[\Delta]=0\): it involves \(ee^\top\Delta\), so the relevant dependence is between the weights and products of errors. The interaction may offset some or all of the nonnegative fluctuation term.

Worked Example: Risk Under Fixed Weights

Suppose two members have mean-zero errors with second-moment matrix \(M=\begin{pmatrix}4&1\\1&1\end{pmatrix}\). Use fixed weights \(w=(0.25,0.75)^\top\). Calculate the aggregate risk.

The fixed-weight formula gives

$$ \begin{aligned} R(w) &=w^\top M w\\ &=(0.25)^2(4)+2(0.25)(0.75)(1)+(0.75)^2(1)\\ &=0.25+0.375+0.5625\\ &=1.1875. \end{aligned} $$

The off-diagonal entries contribute \(2(0.25)(0.75)(1)\); omitting that term would incorrectly give \(0.8125\). This calculation is the fixed-weight baseline against which a random weighting rule can be compared.

When Random Weights Are Independent of Evaluation Errors

Independence is a useful special case, but it is stronger than merely having mean-zero weight fluctuations. If \(W\) is independent of \(e\), then \(E[ee^\top\Delta]=E[ee^\top]E[\Delta]=0\). The interaction term vanishes, leaving only the nonnegative cost of weight variability around \(\mu\).

Result: If \(W\) is independent of \(e\), \(M=E[ee^\top]\) exists, and \(E[WW^\top]\) is finite, then
$$ R(W)=\mu^\top M\mu+\operatorname{tr}(M\operatorname{Var}(W)), \qquad \mu=E[W]. $$
In particular, \(R(W)\geq R(\mu)\), because \(M\) and \(\operatorname{Var}(W)\) are positive semidefinite.

Proof. Independence and \(E[\Delta]=0\) imply \(E[ee^\top\Delta]=E[ee^\top]E[\Delta]=0\), so the exact decomposition reduces to \(R(W)=\mu^\top M\mu+E[\Delta^\top ee^\top\Delta]\). By independence, the second term is \(E[\Delta^\top M\Delta]\). Writing the scalar as a trace and using \(E[\Delta\Delta^\top]=\operatorname{Var}(W)\) gives

$$ E[\Delta^\top M\Delta] =\operatorname{tr}\!\left(M E[\Delta\Delta^\top]\right) =\operatorname{tr}(M\operatorname{Var}(W)). $$

For positive semidefinite matrices \(M\) and \(\operatorname{Var}(W)\), this trace is nonnegative: it equals \(\operatorname{tr}(M^{1/2}\operatorname{Var}(W)M^{1/2})\), the trace of a positive semidefinite matrix. This proves the result. \(\square\)

Worked Example: Dependence Adds Risk Above the Mean-Weight Baseline

Let \(U\) equal \(1\) or \(-1\), each with probability \(1/2\), and let the two member errors be \(e=(U,0)^\top\). Use weights \(W=(1,0)^\top\) when \(U=1\), and \(W=(0,1)^\top\) when \(U=-1\). The weights are nonnegative and sum to one. Compare adaptive risk with risk at the mean weights.

The mean weights are \(\mu=(0.5,0.5)^\top\). With these fixed weights, the aggregate error is \(U/2\), so \(R(\mu)=E[U^2/4]=0.25\). Under the adaptive rule, the aggregate error is \(1\) when \(U=1\) and \(0\) when \(U=-1\). Thus \(R(W)=0.5(1^2)+0.5(0^2)=0.5\).

The decomposition confirms the difference. When \(U=1\), \(\Delta=(0.5,-0.5)^\top\) and \(\Delta^\top e=0.5\); when \(U=-1\), \(\Delta=(-0.5,0.5)^\top\) and \(\Delta^\top e=0.5\). The mean-weight aggregate error is \(U/2\), so

$$ 2E[(\mu^\top e)(\Delta^\top e)] =2E[(U/2)(0.5)]=0, \qquad E[(\Delta^\top e)^2]=0.25. $$

Therefore \(R(W)-R(\mu)=0+0.25=0.25\). Although the weights have mean \(\mu\), their dependence on the error makes their average risk larger than the risk of using \(\mu\) on every case.

Adaptive Weights Can Also Reduce Risk

The word “penalty” can be misleading if it suggests that dependence must increase risk. The squared fluctuation term is always nonnegative, but the interaction can be negative and larger in magnitude. In that case adaptive weighting improves on the fixed mean-weight aggregate. The next example uses error information from the same evaluation case, so it illustrates the algebra rather than a generally implementable prediction rule.

Worked Example: Idealized Adaptation Cancels the Risk

There are two equally likely error scenarios: \(e=(1,0)^\top\) and \(e=(0,1)^\top\). A rule assigns all weight to the member with zero error in each scenario: \(W=(0,1)^\top\) in the first and \(W=(1,0)^\top\) in the second. Compare this rule with its mean weights.

The mean weights are \(\mu=(0.5,0.5)^\top\). Under these fixed weights the aggregate error is \(0.5\) in either scenario, giving \(R(\mu)=0.25\). Under the adaptive rule the aggregate error is zero in both scenarios, so \(R(W)=0\).

In each scenario, \(\mu^\top e=0.5\) and \(\Delta^\top e=-0.5\). Hence the interaction contribution is \(2(0.5)(-0.5)=-0.5\) in either scenario, while the squared fluctuation contribution is \((-0.5)^2=0.25\). Combining terms gives

$$ R(W)=0.25-0.5+0.25=0. $$

The negative interaction more than offsets the positive fluctuation term. But this rule needs to know which member has zero error on the evaluation case, information that ordinarily depends on its outcome. In a real prediction setting, weights based on observed error estimates can still be associated with future errors, but that relationship must be assessed for the actual evaluation process; same-case oracle information should not be mistaken for a deployable rule.

What the Dependence Is—and Is Not

The exact decomposition applies to the joint distribution of the weights and evaluation errors. It does not require weights to be calculated directly from the true errors. For example, weights may be estimated from training or validation predictions, while the errors of interest are on new cases. Whether the interaction vanishes depends on the relationship between those random weights and the new-case errors, not simply on the fact that the weights were estimated in advance.

Conditioning makes this distinction precise. For any random \(W\) and \(e\) with finite squared risk,

$$ R(W)=E\!\left[W^\top E[ee^\top\mid W]W\right]. $$

This follows by conditioning \((W^\top e)^2\) on \(W\), which is then fixed inside the conditional expectation. If \(E[ee^\top\mid W]\) varies with \(W\), replacing it by the unconditional matrix \(M\) is generally invalid. If \(W\) and \(e\) are independent, the conditional second moment is \(M\), and the independent-weight result applies.

A practical analysis should therefore state what information determines the weights and which cases define the risk. Weights chosen using error estimates may be independent of future evaluation errors under a suitable sampling design, or they may remain dependent because of shared data, model fitting, or distributional structure. The risk identity describes the consequences without assuming one answer in advance.

Common Mistake

  • Wrong reasoning: “The random weights have mean \(\mu\), so their risk equals the fixed-weight risk \(\mu^\top M\mu\).” This silently replaces the random product \(W^\top ee^\top W\) by a product of separate expectations.
  • Correction: Mean weights determine the fixed-weight baseline, not the adaptive risk. The exact difference includes \(2\mu^\top E[ee^\top\Delta]\) and \(E[(\Delta^\top e)^2]\). Independence makes the first term zero; dependence need not. The net change can be positive or negative.
Key takeaway: For squared loss, adaptive-weight risk is not determined by the mean weights alone. Relative to those mean weights, the change is an interaction term plus a nonnegative squared-fluctuation term; only the full sum determines whether dependence raises or lowers risk.

Check Your Understanding

Use the risk decompositions above to answer the following questions.

  1. Why is \(M=E[ee^\top]\) the appropriate matrix for the fixed-weight squared-risk formula when the errors need not have mean zero?
  2. In the exact adaptive-weight decomposition, which term is always nonnegative, and why can the other term have either sign?
  3. What additional assumption makes the interaction term vanish and yields a nonnegative difference from the mean-weight baseline?
  4. In the two-scenario example, identify the interaction and squared-fluctuation contributions to the risk change.
  5. Why does a rule that uses the evaluation outcome to identify the zero-error member not automatically describe a usable prediction procedure?
Clinical Biostats