Tutorials › Statistical Learning (Graduate) › Bias-Variance Bounds from Forest Weights

Randomized Forests and Consistency · Tutorial 850 of 989

Bias-Variance Bounds from Forest Weights

Learn how honest forest weights turn prediction error into a bias term governed by localization and a variance term governed by weight concentration.

Advanced 10 min read

What You'll Learn

  • State the assumptions needed for a forest-weight error decomposition.
  • Separate weighted regression-function bias from conditional response variance.
  • Bound bias using smoothness of the regression function and distances to the query.
  • Bound variance using conditional response variances and squared forest weights.
  • Interpret the effective sample size and apply the bound in numerical examples.

Why Forest Weights Give a Useful Error Bound

A forest prediction at a query point \(x\) is a weighted average of training responses. That representation exposes two distinct sources of error. The responses may be noisy even when the weights select observations near \(x\); and the weights may put substantial mass on observations whose regression means differ from the mean at \(x\). A useful bound must keep these sources separate: response variance is controlled by squared weights, while regression-function bias is controlled by how far the weighted observations are from the query.

The separation requires care about how the weights were constructed. In particular, the response values used to estimate the leaf predictions must not also determine the weights in a way that destroys their conditional mean-zero residual property. Honesty provides a sufficient condition: conditional on the training covariates and the forest construction, the estimation responses have their stated conditional means and variances.

Setup and Conditional Decomposition

Definition: Let \((X_i,Y_i)\), \(i=1,\ldots,n\), be estimation observations, with regression function \(m(z)=E[Y_i\mid X_i=z]\) and conditional variance \(\sigma^2(z)=\operatorname{Var}(Y_i\mid X_i=z)\). At a query point \(x\), a forest-weight predictor is $$ \hat m(x)=\sum_{i=1}^n W_i(x)Y_i, $$ where \(W_i(x)\geq 0\) and \(\sum_{i=1}^n W_i(x)=1\). The weights may be random. We condition on the training covariates and forest-construction randomness, denoted together by \(\mathcal G\).

For the results below, assume the estimation responses are conditionally independent given \(\mathcal G\), with \(E[Y_i\mid\mathcal G]=m(X_i)\) and \(\operatorname{Var}(Y_i\mid\mathcal G)=\sigma^2(X_i)<\infty\). The weights are fixed given \(\mathcal G\). This is the relevant implication of honesty here: the randomness used to choose the weights does not use the estimation responses in a way that changes these conditional moments. If weights depend on those same responses, the decomposition below need not hold.

Write the conditional weighted bias as \(B_W(x)=\sum_i W_i(x)\{m(X_i)-m(x)\}\). The predictor's conditional mean is \(m(x)+B_W(x)\). Conditional independence makes the variance of the weighted response noise a sum of squared weights.

Theorem: Under the setup above, for every fixed query point \(x\), $$ E\!\left[(\hat m(x)-m(x))^2\mid\mathcal G\right] = \left(\sum_{i=1}^n W_i(x)\{m(X_i)-m(x)\}\right)^2 +\sum_{i=1}^n W_i(x)^2\sigma^2(X_i). $$

To prove the identity, decompose each response as \(Y_i=m(X_i)+\varepsilon_i\), where \(E[\varepsilon_i\mid\mathcal G]=0\). Then $$ \hat m(x)-m(x)=B_W(x)+\sum_{i=1}^n W_i(x)\varepsilon_i. $$ The conditional expectation of the second term is zero, so its cross-product with the fixed conditional bias has expectation zero. Conditional independence gives \(E[\varepsilon_i\varepsilon_j\mid\mathcal G]=0\) for \(i\ne j\), while \(E[\varepsilon_i^2\mid\mathcal G]=\sigma^2(X_i)\). Expanding the square therefore gives the stated bias square plus the sum of weighted variances. \(\square\)

Bounding the Bias and Variance

A smoothness condition converts bias into a localization measure. Suppose \(m\) is \(L\)-Lipschitz in a metric \(d\): for all relevant \(z,x\), \(|m(z)-m(x)|\leq Ld(z,x)\). By the triangle inequality and nonnegative normalized weights, $$ |B_W(x)|\leq L\sum_{i=1}^n W_i(x)d(X_i,x). $$ Squaring gives one useful bound. Jensen's inequality for the convex function \(t\mapsto t^2\), applied to the probability weights \(W_i(x)\), gives another, often looser, bound in terms of weighted squared distances.

Bound: If \(m\) is \(L\)-Lipschitz and \(\sigma^2(X_i)\leq \bar\sigma^2\) for all estimation observations, then $$ E\!\left[(\hat m(x)-m(x))^2\mid\mathcal G\right] \leq L^2\left(\sum_{i=1}^n W_i(x)d(X_i,x)\right)^2 +\bar\sigma^2\sum_{i=1}^n W_i(x)^2 $$ and hence also $$ E\!\left[(\hat m(x)-m(x))^2\mid\mathcal G\right] \leq L^2\sum_{i=1}^n W_i(x)d(X_i,x)^2 +\bar\sigma^2\sum_{i=1}^n W_i(x)^2. $$

The first inequality follows by bounding the absolute bias term by term and using the variance bound in the decomposition. For the second, Jensen gives \((\sum_i W_i d_i)^2\leq\sum_i W_i d_i^2\), where \(d_i=d(X_i,x)\). Thus the bias is small when the weights concentrate near \(x\), and the variance is small when no small set of observations carries too much weight.

The quantity \(N_{\mathrm{eff}}(x)=1/\sum_i W_i(x)^2\) is called the effective sample size of these weights. Since the weights sum to one, \(N_{\mathrm{eff}}(x)\geq1\); equal weights on \(k\) observations give \(N_{\mathrm{eff}}(x)=k\). Under the variance bound, the conditional response-variance contribution is at most \(\bar\sigma^2/N_{\mathrm{eff}}(x)\). A large effective sample size does not itself ensure small bias: the observations receiving those weights must also be well localized.

These statements hold conditionally for a realized set of weights. Taking expectations over covariates and construction randomness preserves the bounds after taking expectations of their right-hand sides. The squared-weight term concerns response noise conditional on the construction. If the prediction itself is randomized across forest constructions and the target is its unconditional risk, variation of the conditional prediction across constructions must also be accounted for; it is not the response-noise term in this decomposition.

Worked Example: Bounding Error from Unequal Distances

Suppose three observations receive weights \(0.5,0.3,0.2\), and their distances from \(x\) are \(0.1,0.4,0.8\). Let \(m\) be \(2\)-Lipschitz and suppose all three conditional response variances are at most \(4\). The weighted distance is $$ 0.5(0.1)+0.3(0.4)+0.2(0.8)=0.05+0.12+0.16=0.33. $$ Therefore the squared-bias bound using the weighted distance is \(2^2(0.33)^2=4(0.1089)=0.4356\).

The squared weights sum to \(0.5^2+0.3^2+0.2^2=0.25+0.09+0.04=0.38\), so the conditional response-variance contribution is at most \(4(0.38)=1.52\). The conditional mean-squared error is consequently at most \(0.4356+1.52=1.9556\).

Using the alternative weighted squared-distance bound gives \(0.5(0.1^2)+0.3(0.4^2)+0.2(0.8^2)=0.005+0.048+0.128=0.181\). Its bias bound is \(4(0.181)=0.724\), and its total bound is \(0.724+1.52=2.244\). The first bound is sharper here, as Jensen's inequality permits.

Worked Example: Equal Weights Within a Leaf

Suppose a leaf uses \(k=4\) estimation observations with equal weights, each at distance at most \(h=0.25\) from \(x\). Let \(m\) be \(1.5\)-Lipschitz, and suppose each conditional response variance is at most \(9\). The weighted squared-distance bound for bias is at most \(L^2h^2\), because the weights sum to one and every squared distance is at most \(h^2\). Numerically, this is \(1.5^2(0.25)^2=2.25(0.0625)=0.140625\).

Each weight is \(1/4\), so the squared weights sum to \(4(1/4)^2=1/4\). The variance contribution is at most \(9/4=2.25\). The conditional mean-squared error is at most \(0.140625+2.25=2.390625\). This calculation shows the two competing effects directly: reducing the leaf diameter helps the bias bound, while increasing the number of equally weighted estimation observations reduces the variance bound.

Worked Example: Unequal Weights and Unequal Noise

At a query point, suppose four observations have weights \((1/2,1/4,1/8,1/8)\), distances \((0,0.2,0.4,0.6)\), and conditional variances \((1,2,1,4)\), respectively. Assume \(m\) is \(1\)-Lipschitz. The absolute bias is bounded by the weighted distance: $$ \frac12(0)+\frac14(0.2)+\frac18(0.4)+\frac18(0.6)=0+0.05+0.05+0.075=0.175. $$ Thus the squared bias is at most \(0.175^2=0.030625\).

The conditional variance contribution is calculated using each observation's own variance: $$ \left(\frac12\right)^2(1)+\left(\frac14\right)^2(2)+\left(\frac18\right)^2(1)+\left(\frac18\right)^2(4) =0.25+0.125+0.015625+0.0625=0.453125. $$ The resulting conditional mean-squared error bound is \(0.030625+0.453125=0.48375\). The squared weights sum to \(0.34375\), giving effective sample size \(1/0.34375\), approximately \(2.91\). Because the variances differ, using their individual values gives a more informative calculation than replacing them all by their maximum, \(4\).

From Conditional Bounds to Prediction Risk

The theorem targets the regression function \(m(x)\), the conditional mean response. If the goal is to predict a new response \(Y_0\) at \(x\), rather than estimate its mean, there is additional irreducible noise. Suppose \(Y_0\) is conditionally independent of the estimation responses given the construction, with mean \(m(x)\) and variance \(\sigma^2(x)\). Expanding around \(m(x)\), the cross-product has conditional expectation zero, so $$ E[(\hat m(x)-Y_0)^2\mid\mathcal G] = E[(\hat m(x)-m(x))^2\mid\mathcal G]+\sigma^2(x). $$ This distinction matters: even a predictor that equals \(m(x)\) exactly has response-prediction error \(\sigma^2(x)\), unless the response is conditionally deterministic.

The bound is useful for interpreting what forest-weight conditions accomplish. Localization controls the error from averaging regression means at nearby rather than identical covariates. Weight dispersion controls the response-noise cost. Neither property alone controls both terms, and the bound does not assert that either term vanishes without additional conditions on the sequence of forests and data.

Common Pitfall

  • Wrong reasoning: “The weights are nonnegative and sum to one, so the forest prediction is unbiased for \(m(x)\).” Normalization only makes a weighted average. Its conditional expectation is \(\sum_i W_i(x)m(X_i)\), which need not equal \(m(x)\).
  • Correction: The difference is exactly \(B_W(x)=\sum_iW_i(x)\{m(X_i)-m(x)\}\). It is controlled by smoothness together with localization, not by weight normalization alone.
  • Another common slip: Replacing \(\sum_iW_i^2\sigma^2(X_i)\) by \(\sum_iW_i\sigma^2(X_i)\). The former is the variance of a weighted sum of conditionally independent responses; the squared weights are essential.

For a non-honest, response-adaptive weighting rule, one must also verify that conditional residuals still have mean zero given the weights. Without that condition, the displayed bias-variance identity is not justified merely by writing down normalized weights.

Check Your Understanding

Use the decomposition and bounds to answer the following.

  1. Which assumptions allow the conditional variance of the weighted responses to be written as a sum involving squared weights?
  2. If \(m\) is \(L\)-Lipschitz, state a bound on the squared bias using the weighted average distance to \(x\).
  3. For equal weights on \(k\) observations, what are the squared-weight sum and effective sample size?
  4. Why does a large effective sample size not, by itself, guarantee a small bias?
  5. How does the conditional prediction risk for a new response differ from the mean-estimation error?
Clinical Biostats