Why Pairwise Diversity Has an Exact Role
An ensemble averages predictions from several fitted models. Under squared error, its performance is not just related to the members’ errors: there is an exact accounting identity. The ensemble’s risk equals the average risk of its members minus a nonnegative term measuring how far their predictions disagree. This term is often called diversity, but its normalization matters: different definitions of diversity produce different coefficients in the identity.
The identity applies to equal-weight averages and squared-error loss. It is an algebraic fact at each test observation, not a claim that diverse models must be accurate. If all members make the same poor prediction, there is no diversity to subtract and averaging does not improve their shared error.
Definitions and Assumptions
For a random test pair \((X,Y)\), define the member risk \(R_m=E[(Y-\hat f_m(X))^2]\) and the ensemble risk \(R_{\mathrm{ens}}=E[(Y-\bar f_M(X))^2]\). Here the predictors are treated as fixed functions. Assume they are measurable and that \(E[Y^2]<\infty\) and \(E[\hat f_m(X)^2]<\infty\) for every \(m\). These sufficient moment conditions make the risks and diversity below finite.
The pointwise definition also has a pairwise form: \(d_M(x)=M^{-2}\sum_{i<j}(\hat f_i(x)-\hat f_j(x))^2\). The sum here is over unordered pairs. In particular, the denominator is \(M^2\), not the number of pairs. If diversity is instead defined as the unnormalized average over pairs, the coefficient in the risk identity must change.
The Pointwise Identity
Proof. Write \(y-a_m=(y-\bar a)-(a_m-\bar a)\), square, and average over \(m\):
The middle term is zero because \(\sum_m(a_m-\bar a)=\sum_m a_m-M\bar a=0\). This proves the first equality. To obtain the pairwise form, expand the sum over pairs:
On the other hand, \(\sum_m(a_m-\bar a)^2=\sum_m a_m^2-M\bar a^2 =\sum_m a_m^2-M^{-1}(\sum_m a_m)^2\). Thus the pairwise sum is \(M\sum_m(a_m-\bar a)^2\). Dividing by \(M^2\) gives exactly the diversity term in the theorem. \(\square\)
Worked Example: Three Predictions at One Test Point
Suppose the response is \(y=10\), and three predictors give \(a_1=8\), \(a_2=10\), and \(a_3=14\). Their ensemble prediction is \(\bar a=(8+10+14)/3=32/3\). Its squared error is \((10-32/3)^2=4/9\).
The individual squared errors are \(4,0,16\), so their average is \(20/3=60/9\). The deviations from the ensemble prediction are \(-8/3,-2/3,10/3\); their squared values sum to \(64/9+4/9+100/9=168/9\). Dividing by \(M=3\), the diversity is \(56/9\). Hence average member error minus diversity is \(60/9-56/9=4/9\), the ensemble squared error.
Check with the pairwise form: the squared differences are \(4,36,16\), summing to \(56\). Dividing by \(M^2=9\) again gives diversity \(56/9\).
From Pointwise Algebra to Risk
Proof. Apply the pointwise theorem with \(y=Y\) and \(a_m=\hat f_m(X)\). Its first term on the left is \(M^{-1}\sum_m(Y-\hat f_m(X))^2\); its first term on the right is \((Y-\bar f_M(X))^2\). Taking expectations gives the risk identity, because expectation distributes over a finite sum. Applying the pairwise form of the pointwise theorem and taking expectations gives the displayed pairwise expression for \(D_M\). The assumed second moments ensure all squared terms are integrable, so these expectations are finite. \(\square\)
The result requires no independence among the members’ predictions. It follows from averaging real numbers at each input and then taking expectation. The pairwise terms are nonnegative, so the ensemble risk cannot exceed the average member risk under these conditions. That comparison is with the average member risk; it does not say the ensemble beats every member.
Worked Example: Risk Over a Two-Point Test Distribution
Let the test pair take two values. With probability \(1/4\), \(Y=0\) and the three predictions are \(0,2,4\). With probability \(3/4\), \(Y=2\) and the predictions are \(1,2,3\). Calculate the risks and diversity by conditioning on the two outcomes.
At the first outcome the ensemble predicts \(2\), so its squared error is \(4\). The members’ squared errors are \(0,4,16\), averaging \(20/3\). Their deviations from their mean prediction \(2\) are \(-2,0,2\), so diversity is \((4+0+4)/3=8/3\). Indeed, \(20/3-8/3=4\).
At the second outcome the ensemble predicts \(2\), with squared error \(0\). Member squared errors are \(1,0,1\), averaging \(2/3\). The deviations are \(-1,0,1\), so diversity is \(2/3\), and \(2/3-2/3=0\).
Averaging over the test distribution, the ensemble risk is \((1/4)4+(3/4)0=1\). The average member risk is \((1/4)(20/3)+(3/4)(2/3)=5/3+1/2=13/6\). The risk-level diversity is \((1/4)(8/3)+(3/4)(2/3)=2/3+1/2=7/6\). Thus \(13/6-7/6=1\), as required.
Random Fitted Predictors
In practice, a fitted predictor can depend on a random training sample or algorithmic randomness. The pointwise identity still applies after fitting: for each realized training sample, use the predictions it produced as the numbers \(a_1,\ldots,a_M\). If the relevant squared quantities have finite expectation over both training randomness and the test distribution, taking expectation over both sources preserves the identity. Equivalently, one can first condition on the training data, apply the fixed-predictor identity, and then average over the training-data distribution.
No independence between the fitted members is needed for this algebra. If test risk is defined conditionally on a realized training set, the identity holds conditionally. If risk is unconditional, average all terms over the training-set randomness as well. What must be specified is which randomness the risk averages over.
Worked Example: Averaging Over Training Randomness
Fix one test input with response \(Y=0\). A random training procedure has two equally likely outcomes. In outcome A, two fitted predictors give \(1\) and \(3\); in outcome B, they give \(-1\) and \(1\). For either outcome the pairwise difference has magnitude \(2\), so diversity is \(2^2/2^2=1\).
In outcome A the ensemble predicts \(2\), with squared error \(4\). The member errors are \(1\) and \(9\), averaging \(5\), and \(5-1=4\). In outcome B the ensemble predicts \(0\), with squared error \(0\). The member errors are both \(1\), averaging \(1\), and \(1-1=0\).
Averaging over the two equally likely training outcomes gives ensemble risk \((4+0)/2=2\), average member risk \((5+1)/2=3\), and expected diversity \((1+1)/2=1\). Therefore \(3-1=2\). This calculation does not require the two fitted predictors to be generated independently.
Equality, Interpretation, and a Common Pitfall
Because \(D_M\) is an expectation of nonnegative squared differences, it is nonnegative. For \(M\geq2\), it is zero exactly when all member predictions agree almost surely under the distribution of \(X\). To see this, the pairwise representation writes \(D_M\) as a finite sum of expectations of nonnegative random variables. If \(D_M=0\), each expectation is zero; a nonnegative random variable with expectation zero is zero almost surely. Thus every pair agrees almost surely. Conversely, almost-sure agreement makes every pairwise squared difference zero and hence \(D_M=0\). For \(M=1\), diversity is zero by definition.
The subtraction term is prediction spread, not a direct measure of accuracy. Large disagreement can lower the ensemble’s risk relative to the members’ average, but the member average itself may still be large. The identity is a comparison among risks for the same test distribution and the same squared-error loss; it does not establish performance under another loss or on a different population.
- Pitfall: treating any reported pairwise average as \(D_M\). If one defines the mean squared difference across unordered pairs as \(\binom{M}{2}^{-1}\sum_{i<j}(\hat f_i-\hat f_j)^2\), that quantity is not \(D_M\). The correct conversion is \(D_M=\frac{M-1}{2M}\) times that pair-average.
- Correction: State the normalization first. The identity as given uses \(D_M=M^{-2}\sum_{i<j}E[(\hat f_i(X)-\hat f_j(X))^2]\). Substituting a differently normalized diversity without changing its coefficient gives an incorrect risk calculation.
- Pitfall: concluding that diversity guarantees a good ensemble. The identity only subtracts diversity from average member risk. If all members are inaccurate in a similar way, their average risk can remain high.
Check Your Understanding
Use the definitions and normalization in this tutorial.
- For predictions \(2,4,8\) at a fixed input, calculate the ensemble prediction and pointwise diversity using deviations from the ensemble prediction.
- Why does the pointwise identity require no independence assumption among predictors?
- For \(M=2\), express the diversity in terms of the squared difference between the two predictions.
- What finite-moment assumptions are sufficient for the risk identity, and what role do they play?
- If the pairwise squared differences are averaged over unordered pairs instead, what factor converts that average to \(D_M\)?