Quant Memo
Core

Ensemble Variance as an Uncertainty Estimate

How much the individual trees in an ensemble disagree with each other on a given prediction is a free, usable signal for how much to trust that prediction.

Prerequisites: Random Forests and Out-of-Bag Error, The Bias-Variance Decomposition

A random forest's headline prediction is just the average of what every tree in it says. That average throws away something useful sitting right there for free: whether the trees agree. If all 300 trees predict roughly the same number for a given input, that is a very different situation from 300 trees scattered widely around the same average — even though both cases might report the identical mean prediction.

The analogy: a room full of forecasters

Ask 300 independent forecasters to guess tomorrow's temperature. If 290 of them say "72 degrees, give or take one" and the average comes out to 72, you would trust that average. If instead the guesses range wildly from 50 to 95 and just happen to average to 72, you should trust that same average number far less — the forecasters clearly disagree about something, which usually means the input situation is unusual or hard to predict. The average is identical in both cases; the spread across forecasters is the extra information that tells you which situation you are in.

The maths: spread across trees, not just their mean

For a random forest with TT trees, each producing a prediction y^t(x)\hat{y}_t(x) for input xx, the ensemble variance is simply the sample variance of those TT numbers:

Var^(x)=1T1t=1T(y^t(x)yˉ(x))2,yˉ(x)=1Tt=1Ty^t(x)\widehat{\mathrm{Var}}(x) = \frac{1}{T-1}\sum_{t=1}^{T}\left(\hat{y}_t(x) - \bar{y}(x)\right)^2, \qquad \bar{y}(x) = \frac{1}{T}\sum_{t=1}^{T}\hat{y}_t(x)

In plain English: take the ensemble's usual average prediction yˉ(x)\bar{y}(x), then measure how far each individual tree's prediction typically strays from that average — a large spread means the trees are seeing this input as unusual or hard, a small spread means they broadly agree.

This is a genuine, if imperfect, uncertainty estimate: it does not directly capture bias (all the trees could agree and still be systematically wrong), but it does capture one real source of uncertainty — how sensitive the prediction is to which particular training data and random splits happened to be used to build each tree.

Worked example 1: two inputs, same mean, different spread

Input A gets tree predictions {2.9, 3.0, 3.1, 3.0, 3.0} — mean 3.03.0, variance 0.0050\approx 0.0050. Input B gets tree predictions {0.5, 5.5, 1.0, 4.8, 3.2} — mean 3.03.0, variance 4.65\approx 4.65. Both report the identical point prediction of 3.03.0, but input B's near-thousandfold larger variance says the trees fundamentally disagree about it — likely because it lies in a sparse or unusual region of feature space where different bootstrap samples and random splits produce very different trees. A downstream system that only reads the mean would treat these two predictions as equally trustworthy; one that reads the variance would not.

Worked example 2: turning variance into a rough confidence band

Continuing input A (mean 3.03.0, variance 0.00500.0050, so standard deviation 0.071\approx 0.071): a rough interval is 3.0±2(0.071)=[2.86,3.14]3.0 \pm 2(0.071) = [2.86, 3.14] — tight. For input B (mean 3.03.0, standard deviation 2.16\approx 2.16): 3.0±2(2.16)=[1.3,7.3]3.0 \pm 2(2.16) = [-1.3, 7.3] — a band so wide it says almost nothing useful is known. This is a crude normal-approximation band, not a rigorous one (the jackknife and infinitesimal-jackknife methods correct for extra bias this naive variance introduces), but it makes the qualitative point concrete: the same point prediction can carry wildly different real confidence.

input A: low variance input B: same mean, high variance
Both inputs average to the same prediction, but input B's trees disagree far more — a real signal the mean alone hides.

Convergence explorer
true meansamples →
after n = 200estimate -0.025error 0.025std error 0.071

The explorer above shows a running average settling as more samples accumulate, with its envelope narrowing over time — ensemble variance is the same idea read at a single input, across trees instead of across a growing sample: a tight envelope means the trees have converged to a shared answer, a wide one means they have not.

The variance of individual tree predictions around the ensemble mean is a usable, nearly-free uncertainty signal — low variance means the trees agree and the prediction is on familiar ground, high variance means the input sits somewhere the model is genuinely unsure about, even when the point prediction looks unremarkable.

What this means in practice

Quant teams use ensemble variance to filter or downweight predictions in unfamiliar regions of feature space — skipping trades where the forest's trees disagree sharply, or sizing positions smaller when variance is high, functionally acting like a confidence-based risk control layered on top of an otherwise ordinary point forecast.

Ensemble variance measures how much trees disagree given the current training data and randomization — it does not detect if the entire forest is systematically biased in the same direction (all trees agreeing while all being wrong), which happens when the training data itself is unrepresentative of the situation being predicted, such as an out-of-regime market. Low variance is evidence of consistency, not evidence of correctness.

Related concepts

Practice in interviews

Further reading

  • Wager, Hastie & Efron, Confidence Intervals for Random Forests: The Jackknife and the Infinitesimal Jackknife (2014)
ShareTwitterLinkedIn