Tutorials › Statistical Learning (Graduate) › Finite-Sample Risk Bounds for Honest Forests

Randomized Forests and Consistency · Tutorial 862 of 989

Finite-Sample Risk Bounds for Honest Forests

Learn how to decompose an honest forest’s prediction risk and identify the conditional assumptions needed to bound its estimation and Monte Carlo errors.

Advanced 12 min read

What You'll Learn

  • Define honest forest weights and the prediction-risk target used in the bound
  • Separate partition approximation error from estimation noise and finite-tree error
  • Prove a finite-sample risk decomposition under conditional moment assumptions
  • Bound leaf estimation variance using squared forest weights
  • Bound finite-tree Monte Carlo error and compute its exact value in a simple example
  • Diagnose why marginal variance bounds may fail when weights depend on covariates

Why a Finite-Sample Bound Needs Three Terms

A forest prediction can be inaccurate for different reasons. A tree may average responses from covariate points whose regression means differ from the test point’s mean; this is partition approximation error. Even if the relevant mean is represented well, only finitely many noisy responses may contribute to a leaf; this creates leaf estimation variance. Finally, a practical forest averages a finite number of randomized trees, rather than every possible tree; this adds Monte Carlo error.

Separating these sources is useful because they require different remedies. Better localization can reduce approximation error, more estimation observations per leaf can reduce the effect of response noise, and more trees can reduce Monte Carlo error. A finite-sample bound makes this separation precise without claiming that any one term is automatically small.

Setup and Assumptions

Let \(X\) be an independent test covariate, and let its regression function be \(m(x)=E[Y\mid X=x]\). The estimation sample has covariates \(X_1,\ldots,X_n\) and responses \(Y_i=m(X_i)+\varepsilon_i\). The partition is built honestly: conditional on its construction information, the estimation responses do not determine the prediction weights. We allow the partition to use separate structure data, including responses from that data.

For a test point \(x\), write the prediction from one randomized tree as a weighted average \(T(x;Y,U)=\sum_{i=1}^n W_i(x;U)Y_i\), where \(U\) denotes that tree’s randomization. Assume the weights are nonnegative and sum to one. They can, for example, be equal weights on the estimation observations in the same leaf as \(x\). Assume every tree uses the same estimation sample, and the randomizations for different trees are independent and identically distributed conditional on the data and construction information.

Conditional moment and boundedness assumptions: Let \(\mathcal G\) contain the test covariate \(X\), all estimation covariates \(X_1,\ldots,X_n\), and all information used to construct the partition. Conditional on \(\mathcal G\), suppose \(E[\varepsilon_i\mid\mathcal G]=0\), \(E[\varepsilon_i^2\mid\mathcal G]\leq \sigma^2\), and \(E[\varepsilon_i\varepsilon_j\mid\mathcal G]=0\) for \(i\ne j\), almost surely. Assume the tree randomizations are conditionally independent of the estimation errors given \(\mathcal G\), and that \(|Y_i|\leq M\) almost surely. These are sufficient conditions for the bound below; conditional independence of the errors given \(\mathcal G\) is one way to obtain the required zero cross-moments.

The conditioning in these assumptions matters. Honesty prevents the estimation responses from choosing the weights, but it does not by itself imply that an error’s conditional variance stays bounded after conditioning on every covariate and on the structure information. We will return to this distinction in a worked example.

Let \(\bar W_i(x)=E_U[W_i(x;U)\mid\mathcal G]\) be the mean weight across randomized trees. The infinite-tree prediction for a fixed estimation sample is \(\sum_i\bar W_i(x)Y_i\). For \(B\) trees, let \(F_B(x)=B^{-1}\sum_{b=1}^B T(x;Y,U_b)\).

Definition: The partition approximation error at \(x\) is the squared difference between the weighted regression means and the test-point regression mean: \(\left\{\sum_i\bar W_i(x)m(X_i)-m(x)\right\}^2\). The leaf estimation variance bound is \(\sigma^2\sum_i\bar W_i(x)^2\). It is small when the mean weights are spread across many estimation observations, subject to the conditional moment assumptions above.

A Finite-Sample Risk Bound

The risk here is squared prediction error, averaged over the test covariate, estimation sample, partition construction, estimation errors, and tree randomizations. No asymptotic limit or rate condition is needed for the following result.

Theorem: Under the assumptions above, for every positive integer \(B\), \[ E\left[\{F_B(X)-m(X)\}^2\right] = E\left[\left\{\sum_i\bar W_i(X)m(X_i)-m(X)\right\}^2\right] + E\left[\operatorname{Var}\left\{\sum_i\bar W_i(X)\varepsilon_i\mid\mathcal G\right\}\right] + \frac{1}{B}E\left[\operatorname{Var}_U\{T(X;Y,U)\mid Y,\mathcal G\}\right], \] and therefore \[ E\left[\{F_B(X)-m(X)\}^2\right] \leq E\left[\left\{\sum_i\bar W_i(X)m(X_i)-m(X)\right\}^2\right] +\sigma^2 E\left[\sum_i\bar W_i(X)^2\right] +\frac{M^2}{B}. \] Here \(\operatorname{Var}_U\) denotes variance over a fresh tree randomization with the estimation data and \(\mathcal G\) held fixed.

The first term is the approximation error induced by the forest’s mean partition weights. The second bounds the noise remaining in the infinite-tree prediction. The last term is the finite-tree contribution. The last bound is deliberately general; when the conditional variance of a tree prediction can be calculated or bounded more sharply, it can replace \(M^2\).

Proof of the Decomposition

Fix \(\mathcal G\) and the estimation responses. Conditional on these quantities, the \(B\) tree predictions are independent, have common mean \(\sum_i\bar W_i(X)Y_i\), and have common variance \(\operatorname{Var}_U\{T(X;Y,U)\mid Y,\mathcal G\}\). Thus the conditional mean squared deviation of their average from that common mean is the single-tree variance divided by \(B\). The deviation has conditional mean zero, so its cross-product with the difference between the common mean and \(m(X)\) has conditional expectation zero. Consequently, \[ E_U[\{F_B(X)-m(X)\}^2\mid Y,\mathcal G] = \left\{\sum_i\bar W_i(X)Y_i-m(X)\right\}^2 +\frac{1}{B}\operatorname{Var}_U\{T(X;Y,U)\mid Y,\mathcal G\}. \]

Now condition on \(\mathcal G\). The weights \(\bar W_i(X)\) and the values \(m(X_i)\) are fixed under this conditioning. Substituting \(Y_i=m(X_i)+\varepsilon_i\), the infinite-tree prediction error is the sum of \(a(X)=\sum_i\bar W_i(X)m(X_i)-m(X)\) and \(\sum_i\bar W_i(X)\varepsilon_i\). The latter has conditional mean zero. Expanding its conditional second moment gives \[ E\left[\left\{\sum_i\bar W_i(X)\varepsilon_i\right\}^2\middle|\mathcal G\right] = \sum_i\bar W_i(X)^2 E[\varepsilon_i^2\mid\mathcal G] + \sum_{i\ne j}\bar W_i(X)\bar W_j(X)E[\varepsilon_i\varepsilon_j\mid\mathcal G]. \] The cross-moment assumptions make the second sum zero. The conditional variance is therefore at most \(\sigma^2\sum_i\bar W_i(X)^2\). This proves the first two terms of the stated bound.

Finally, nonnegative weights summing to one imply \(|T(X;Y,U)|\leq M\). Hence \(\operatorname{Var}_U\{T(X;Y,U)\mid Y,\mathcal G\}\leq E_U[T(X;Y,U)^2\mid Y,\mathcal G]\leq M^2\). Substituting this inequality into the exact decomposition proves the result. \(\square\)

Worked Examples

Worked Example: Approximation Error and Noise in One Leaf

Suppose a test point has \(m(x)=2.5\), and a nonrandom tree puts two estimation observations in its leaf, with regression means \(m(X_1)=1\) and \(m(X_2)=3\). Give them equal weights. Suppose their errors are conditionally uncorrelated, each taking values \(+0.5\) and \(-0.5\) with equal probability. Find the infinite-tree risk conditional on these covariates.

The weights are \(\bar W_1=\bar W_2=0.5\). The weighted mean is \(0.5(1)+0.5(3)=2\), so the approximation error is \((2-2.5)^2=0.25\).

Each error has variance \(0.25\). The estimation variance is \(0.25\{(0.5)^2+(0.5)^2\}=0.25(0.5)=0.125\). The cross-moment is zero by the stated conditional uncorrelatedness. Thus the conditional squared risk is \(0.25+0.125=0.375\). Since the weights do not vary across trees, the Monte Carlo term is zero for every \(B\). This calculation separates a nonzero approximation error from the noise due to estimating the leaf mean.

Worked Example: Exact Finite-Tree Error

At a fixed test point, suppose there are two possible randomized tree predictions: one tree selects an estimation response equal to \(0\), and the other selects a response equal to \(2\), each with probability \(1/2\). Take \(m(x)=1\), with no estimation noise. Compute the risk from averaging \(B\) independent trees.

The mean tree prediction is \(0.5(0)+0.5(2)=1\), which equals \(m(x)\). Thus the approximation error is zero, and the leaf estimation variance term is zero because the responses have no noise. Let \(K\) be the number of trees selecting response \(2\). Then \(K\sim\operatorname{Binomial}(B,1/2)\), and \(F_B(x)=2K/B\). Since \(E[K]=B/2\) and \(\operatorname{Var}(K)=B/4\), \[ E[\{F_B(x)-1\}^2] =\operatorname{Var}(2K/B) =\frac{4}{B^2}\frac{B}{4} =\frac{1}{B}. \]

This is exactly the Monte Carlo contribution. The general bound uses \(M^2/B=4/B\), because the tree predictions lie between \(-2\) and \(2\), so \(M=2\); the exact calculation is sharper. It also shows why increasing the number of trees addresses this particular error without changing the underlying tree predictions.

Worked Example: Why Marginal Error Variances Are Not Enough

Let \(X_1\) be constant and let \(X_2=Z\), where \(P(Z=1)=P(Z=0)=1/2\). Set \(m=0\) and \(\varepsilon_2=0\). Conditional on \(Z=1\), let \(\varepsilon_1\) equal \(+a\) or \(-a\) with equal probability; conditional on \(Z=0\), let \(\varepsilon_1=0\). Use deterministic honest weights \((1,0)\) when \(Z=1\), and \((1/2,1/2)\) when \(Z=0\).

The conditional error mean is zero, and \(E[\varepsilon_1^2\mid X_1]=a^2/2\). But the risk of the weighted prediction is \(a^2\) when \(Z=1\) and zero when \(Z=0\), giving total risk \(a^2/2\). Meanwhile, \[ E[\bar W_1^2+\bar W_2^2] =\frac12(1^2+0^2)+\frac12\{(1/2)^2+(1/2)^2\} =\frac12+\frac14=\frac34. \] Using the marginal bound \(\sigma^2=a^2/2\) would give a variance bound of \((a^2/2)(3/4)=3a^2/8\), which is smaller than the actual risk \(a^2/2\).

The issue is that when the weight on \(\varepsilon_1\) is large, \(Z=1\), and the conditional second moment is \(a^2\), not \(a^2/2\). The theorem’s condition must hold after conditioning on both estimation covariates and structure information. Here it holds with \(\sigma^2=a^2\), yielding the valid, though loose, bound \(a^2(3/4)\). Honesty alone does not justify substituting a variance bound conditioned only on \(X_1\).

Using the Bound and Avoiding a Common Pitfall

The bound is finite-sample and makes no promise that its terms vanish. The first term depends on how the forest’s average weights place mass on estimation observations whose regression means resemble \(m(X)\). The second depends on the concentration of those weights as well as the conditional noise level: if the weights are equal on \(N\) observations, their squared sum is \(N(1/N)^2=1/N\). The third term can be reduced by increasing \(B\), while leaving the first two terms unchanged.

A common mistake is to condition on estimation covariates to treat the weights as fixed, then use only a variance bound conditioned on each individual covariate. That step is not valid when errors are heteroskedastic and their conditional variances depend on other covariates that also affect the weights. The correction is to state a bound conditional on the full information determining the weights, as in the theorem, or to establish separately that the sampling and independence conditions imply such a bound. One must also account for conditional cross-moments unless conditional independence or another suitable condition rules them out.

The decomposition is useful as an audit: it identifies which part of a proposed argument needs a localization claim, which needs a conditional noise assumption, and which is solely due to using finitely many trees. It does not replace those assumptions with honesty, nor does it turn a finite-sample inequality into a convergence or rate result.

Check Your Understanding

Use the definitions and assumptions above to answer the following.

  1. If a leaf contains \(N\) estimation observations with equal weights, what is the sum of their squared weights?
  2. Which term in the bound changes when \(B\) increases, and why?
  3. Why does honesty not, by itself, guarantee that the error variance is bounded conditional on all variables determining the weights?
  4. In the first worked example, how would the estimation variance term change if the two weights were \(0.8\) and \(0.2\), keeping the conditional error variances at \(0.25\) and the errors uncorrelated?
  5. What additional moment condition is needed if the estimation errors are not conditionally uncorrelated?
Clinical Biostats