Tutorials › Statistical Learning (Graduate) › Axis-Aligned Trees for Smooth Regression Functions

Partition-Based and Tree Estimators · Tutorial 796 of 989

Axis-Aligned Trees for Smooth Regression Functions

Learn how tree geometry and coordinate-specific smoothness determine approximation error, and how to allocate splits across dimensions.

Intermediate 10 min read

What You'll Learn

  • Bound piecewise-constant approximation error using the widths of axis-aligned cells.
  • Relate Lipschitz smoothness to squared approximation error.
  • Derive how anisotropic smoothness changes the preferred split allocation.
  • Compare equal and uneven coordinate splits at a fixed leaf budget.
  • Distinguish approximation error from the finite-risk projection property of cell means.

Why the Direction of a Split Matters

A tree with many leaves need not approximate a smooth regression function well. Its effectiveness depends on where those leaves are placed: a split that halves a cell along a rapidly changing coordinate can reduce approximation error more than a split along a nearly irrelevant one. This tutorial quantifies that geometric effect for axis-aligned trees, whose splits are threshold cuts in one coordinate at a time.

We study approximation of a regression function \(m\) on \([0,1]^d\). The bounds below concern the function itself and do not require a finite second moment for the response. When we identify a cellwise conditional mean as the best predictor under squared-error risk, we state the additional square-integrability condition explicitly.

Definition: An axis-aligned partition is a partition obtained by recursively cutting rectangular cells with thresholds of the form \(x_j=t\), for some coordinate \(j\) and threshold \(t\). Each terminal cell is a rectangle, up to its boundary. A piecewise-constant predictor assigns one value to each cell. The width of a cell \(C\) in coordinate \(j\) is \(h_j(C)=\sup_{x,z\in C}|x_j-z_j|\).

For a fixed partition \(\mathcal P\), a simple approximation assigns a representative value \(m(x_C)\) to each cell, where \(x_C\in C\). Its error depends on how much \(m\) can vary within each cell. For population prediction, the more usual choice is the cellwise mean. Define \(m_{\mathcal P}(X)=E[m(X)\mid \sigma(\mathcal P)]\), where \(\sigma(\mathcal P)\) records which cell contains \(X\). Cells with probability zero can be assigned any value without affecting the risk.

Lipschitz Functions and Cell Diameters

Suppose \(m\) is \(L\)-Lipschitz in Euclidean distance: for all \(x,z\in[0,1]^d\), \(|m(x)-m(z)|\le L\|x-z\|_2\). If a cell has coordinate widths \(h_1,\ldots,h_d\), its Euclidean diameter is at most \((\sum_{j=1}^d h_j^2)^{1/2}\). Thus the function's oscillation on that cell is bounded by \(L(\sum_j h_j^2)^{1/2}\). Squaring this bound gives a direct squared-error approximation bound.

Result: If \(m\) is \(L\)-Lipschitz and every cell \(C\) of \(\mathcal P\) has widths at most \(h_1,\ldots,h_d\), then for any representative-point approximation \(g(x)=m(x_C)\) on \(C\), \[ \sup_{x\in[0,1]^d}|m(x)-g(x)|^2 \le L^2\sum_{j=1}^d h_j^2. \] The same upper bound holds for \(E[(m(X)-m_{\mathcal P}(X))^2]\), for any distribution of \(X\) on the cube.

For the cell-mean claim, compare the value \(m(x)\) with an average of \(m(X)\) over the same cell. The mean is not necessarily the value at the center, but it cannot be farther from \(m(x)\) than the largest within-cell difference. This argument requires no density or uniformity assumption on \(X\).

Worked Example: Unequal Lipschitz Variation in Two Coordinates

Let \(X\) be uniform on \([0,1]^2\), and let \(m(x_1,x_2)=x_1+2x_2\). Use a rectangular grid with 4 equal intervals in coordinate 1 and 2 equal intervals in coordinate 2, giving 8 leaves. Each cell has widths \(h_1=1/4\) and \(h_2=1/2\). The function is linear, so its conditional mean on a cell equals its value at the cell center.

For a uniform variable on an interval of width \(h\), the variance about its midpoint is \(h^2/12\). The two coordinates are independent, so the squared approximation error is \[ E[(m(X)-m_{\mathcal P}(X))^2] =\frac{h_1^2}{12}+4\frac{h_2^2}{12} =\frac{1}{192}+\frac{1}{12} =\frac{17}{192}. \] The factor 4 in the second coordinate's contribution is the square of its coefficient 2. This makes clear why widths alone do not tell the whole story: variation along a more influential coordinate contributes more.

Anisotropic Smoothness

A single Lipschitz constant treats all directions alike. Many functions instead vary at different rates by coordinate. For \(0<\beta_j\le 1\), suppose that \[ |m(x)-m(z)|\le \sum_{j=1}^d L_j|x_j-z_j|^{\beta_j} \] for all \(x,z\in[0,1]^d\), with constants \(L_j\ge 0\). The exponents \(\beta_j\) and constants \(L_j\) describe coordinate-specific smoothness and scale. A smaller \(\beta_j\), or a larger \(L_j\), generally calls for more resolution in coordinate \(j\).

Result: Under the anisotropic condition above, if every cell has width at most \(h_j\) in coordinate \(j\), then the representative-point approximation and the cell-mean approximation satisfy \[ \sup_x|m(x)-g(x)|\le \sum_{j=1}^d L_jh_j^{\beta_j}, \qquad E[(m(X)-m_{\mathcal P}(X))^2] \le \left(\sum_{j=1}^d L_jh_j^{\beta_j}\right)^2. \]

To verify the first inequality, take any \(x\) in a cell \(C\) with representative \(x_C\). Each coordinate difference is at most \(h_j\), so the assumed smoothness condition gives \(|m(x)-m(x_C)|\le\sum_j L_jh_j^{\beta_j}\). For the cell mean, condition on the cell and let \(X'\) have the conditional distribution of \(X\) there. Then \[ |m(x)-E[m(X')\mid X'\in C]| \le E[|m(x)-m(X')|\mid X'\in C] \le \sum_j L_jh_j^{\beta_j}. \] This holds for almost every \(x\) in each positive-probability cell. Squaring and averaging proves the stated squared-error bound.

In particular, if \(m\) is \(L\)-Lipschitz in Euclidean distance, it also satisfies the coordinatewise bound with \(\beta_j=1\) and \(L_j=L\): the inequality \(\|x-z\|_2\le\sum_j|x_j-z_j|\) gives the claim. This recovers a bound in terms of the sum of cell widths. The Euclidean-diameter bound can be sharper, but both show that reducing widths in important directions improves approximation.

Worked Example: A Function with Different Smoothness by Coordinate

On \([0,1]^2\), consider \(m(x_1,x_2)=x_1+\sqrt{x_2}\). The first coordinate is Lipschitz with constant 1. For the second, \(|\sqrt{u}-\sqrt{v}|\le\sqrt{|u-v|}\) for \(u,v\in[0,1]\), so the anisotropic condition holds with \((\beta_1,\beta_2)=(1,1/2)\) and \(L_1=L_2=1\).

Use 16 equal intervals in coordinate 1 and 256 in coordinate 2. The grid has \(16\cdot256=4096\) leaves, and the bound on the root mean squared approximation error is \[ 16^{-1}+256^{-1/2}=\frac{1}{16}+\frac{1}{16}=\frac{1}{8}. \] Therefore its squared approximation error is at most \(1/64\), for any distribution of \(X\) on the square. The denser subdivision in coordinate 2 reflects its lower smoothness exponent.

For comparison, an equal grid with 64 intervals per coordinate also has 4096 leaves, but its bound on root mean squared error is \[ 64^{-1}+64^{-1/2}=\frac{1}{64}+\frac{1}{8}=\frac{9}{64}, \] so the corresponding squared-error bound is \(81/4096\). The unequal allocation gives a smaller bound, though these are upper bounds rather than exact risks.

How to Allocate a Leaf Budget

A Cartesian grid with \(N_j\) equal intervals in coordinate \(j\) has \(\prod_jN_j\) cells and widths \(h_j=1/N_j\). Such a grid can be formed by recursive axis-aligned splits: cut each coordinate into its intervals, applying the needed cuts within the resulting cells. A binary tree with \(K\) leaves has \(K-1\) internal splits, so the product of the interval counts is also the leaf budget for this construction.

The anisotropic bound for this grid is controlled by \(\sum_j L_jN_j^{-\beta_j}\). Treating \(N_j\) temporarily as positive real numbers and fixing \(\prod_jN_j=K\), one can see the preferred allocation by minimizing this sum. Set \(u_j=\log N_j\); the constraint is \(\sum_j u_j=\log K\). At an interior minimum, a Lagrange multiplier \(\lambda\) gives \[ \beta_jL_jN_j^{-\beta_j}=\lambda \quad\text{for each }j. \] Thus the terms do not generally receive equal numbers of intervals: the balance is between their smoothness-weighted marginal reductions. In particular, when all \(L_j\) are positive and the unconstrained solution has \(N_j\ge1\), it satisfies \[ N_j=\left(\frac{\beta_jL_j}{\lambda}\right)^{1/\beta_j}, \qquad \prod_jN_j=K. \] Actual trees use integer counts and may use dyadic subdivisions, so this continuous calculation guides the allocation rather than specifying an exact tree in every case.

Worked Example: An Irrelevant Coordinate

Let \(X\) be uniform on \([0,1]^2\), and let \(m(x_1,x_2)=x_1\). Divide coordinate 1 into \(N\) equal intervals and use one interval in coordinate 2. The cellwise conditional mean on an interval is its midpoint. Since a uniform variable on an interval of width \(1/N\) has variance \(1/(12N^2)\), the squared approximation error is exactly \(1/(12N^2)\).

Now take a total budget of \(K=64\) leaves. Splitting only along coordinate 1 gives \(N=64\) and risk \[ \frac{1}{12\cdot64^2}=\frac{1}{49152}. \] An equal \(8\)-by-\(8\) grid also has 64 leaves, but it has only 8 intervals in coordinate 1. Splits along coordinate 2 do not change the prediction, so its risk is \[ \frac{1}{12\cdot8^2}=\frac{1}{768}. \] The equal grid's risk is 64 times larger. The function has no variation in coordinate 2, so spending leaves there provides no approximation benefit.

Cell Means and Finite Squared-Error Risk

The preceding approximation bounds concern a bounded smooth function \(m\) and its cellwise average; they do not, by themselves, assert that a response-based predictor has finite squared-error risk. For that prediction claim, suppose \(m(X)=E[Y\mid X]\) and \(E[Y^2]<\infty\). Then \(m(X)\) is square-integrable, and the partition mean \(m_{\mathcal P}(X)=E[Y\mid\sigma(\mathcal P)]\) is also square-integrable. It is the best squared-error predictor among functions constant on each cell.

Result: If \(E[Y^2]<\infty\), then for every square-integrable cell-constant predictor \(g(X)\), \[ E[(Y-g(X))^2] =E[(Y-m_{\mathcal P}(X))^2]+E[(m_{\mathcal P}(X)-g(X))^2]. \] Consequently \(m_{\mathcal P}\) minimizes squared-error risk over such predictors.

For the proof, write \(Y-g=(Y-m_{\mathcal P})+(m_{\mathcal P}-g)\), square, and take expectations. The cross term is zero because \(m_{\mathcal P}-g\) is measurable with respect to the partition, while \(E[Y-m_{\mathcal P}\mid\sigma(\mathcal P)]=0\). Hence \[ E[(Y-m_{\mathcal P})(m_{\mathcal P}-g)] =E[E[Y-m_{\mathcal P}\mid\sigma(\mathcal P)](m_{\mathcal P}-g)] =0. \] All terms are integrable by square-integrability and the Cauchy–Schwarz inequality. The identity follows, and its second term is nonnegative. \(\square\)

Common Mistake

  • Wrong reasoning: “The conditional mean in each cell always minimizes squared-error risk, so no moment assumption is needed.” A conditional mean may exist when \(Y\) has a finite first moment but an infinite second moment; in that case the squared-error risks need not be finite, and the usual finite-risk projection argument does not apply.
  • Correction: Require \(E[Y^2]<\infty\) for the finite-risk best-predictor identity. Keep this separate from smoothness-based approximation bounds for \(m\), which can be established without a second-moment assumption on \(Y\).
  • Wrong reasoning: “A tree with the same number of leaves has the same approximation quality, whatever its split directions.” Leaf count alone does not determine cell widths or function variation within cells.
  • Correction: Track coordinate widths and smoothness. Allocate more splits to coordinates with larger or less regular changes, and avoid spending splits on directions with negligible variation when the goal is approximation.
Key takeaway: Axis-aligned tree approximation is governed by the widths of its cells in the directions where the regression function changes. Lipschitz and anisotropic smoothness translate those widths into error bounds; good split allocation matches the geometry of the partition to the coordinate-specific behavior of the function.

Check Your Understanding

Try these questions before moving on.

  1. For an \(L\)-Lipschitz function on a rectangle with widths \(h_1,\ldots,h_d\), what bound does the Euclidean-diameter argument give for the squared representative-point error?
  2. Suppose \(m\) obeys an anisotropic condition with exponents \(\beta_j\). Explain why the bound for a grid with \(N_j\) intervals per coordinate involves \(L_jN_j^{-\beta_j}\).
  3. Why can an unequal split allocation outperform an equal grid even when both have the same number of leaves?
  4. For \(m(x_1,x_2)=x_1\) under a uniform distribution, calculate the squared approximation error using \(N\) equal intervals along coordinate 1 and no splits along coordinate 2.
  5. What additional condition supports the finite-risk identity that makes the cellwise conditional mean the best squared-error predictor?
Clinical Biostats