Tutorials › Statistical Learning (Graduate) › Piecewise-Polynomial Leaves and Local Approximation

Partition-Based and Tree Estimators · Tutorial 797 of 989

Piecewise-Polynomial Leaves and Local Approximation

Learn how local polynomial leaves approximate smooth regression functions and how to calculate a Taylor-based bound on their squared error.

Intermediate 11 min read

What You'll Learn

  • Define a piecewise-polynomial predictor on a fixed tree partition.
  • Express its population approximation error as a cellwise squared-error infimum.
  • Derive a Taylor remainder bound for polynomial leaves of degree q.
  • Relate derivative bounds and cell diameters to total approximation error.
  • Check the constants in one- and two-dimensional worked examples.
  • Explain why increasing polynomial degree or refining cells cannot worsen the best approximation error.

From Constant Leaves to Polynomial Leaves

A regression tree can use more than a constant prediction in each leaf. If the regression function bends smoothly within a cell, a local polynomial can represent that curvature instead of requiring the partition to split the cell into smaller pieces. This tutorial studies the approximation side of that choice: how well can polynomials of a chosen degree approximate a smooth function on a fixed partition?

The bound developed below is deterministic once the partition and regression function are fixed. It does not say how accurately data estimate the polynomial coefficients, or how well a data-selected tree performs. Those are separate questions. Here the issue is the best possible squared approximation error within a specified piecewise-polynomial class.

Definition: Let \(\mathcal{P}=\{C_1,\ldots,C_K\}\) be a finite measurable partition of the predictor domain in \(\mathbb{R}^d\). A piecewise-polynomial predictor of degree at most \(q\) is a function \(g\) whose restriction to each cell \(C_j\) is a polynomial in \(d\) variables of total degree at most \(q\). The polynomial coefficients may differ across cells, and predictions need not agree at cell boundaries. For regression function \(m(x)=E[Y\mid X=x]\), define its squared approximation error by \[ A_q(\mathcal{P})=\inf_g E[(m(X)-g(X))^2], \] where the infimum is over all such predictors and the expectation is with respect to the distribution of \(X\).

A polynomial of total degree at most \(q\) is a linear combination of monomials \(x_1^{\alpha_1}\cdots x_d^{\alpha_d}\) for nonnegative integer indices satisfying \(\alpha_1+\cdots+\alpha_d\le q\). For example, when \(d=2\) and \(q=1\), each leaf has an affine prediction \(a+b_1x_1+b_2x_2\). When \(q=2\), quadratic terms such as \(x_1^2\) and \(x_1x_2\) are also allowed.

A Taylor Bound for a Fixed Partition

For a smooth function, Taylor expansion supplies a particular polynomial candidate on each cell. Comparing the best local polynomial with this candidate gives an upper bound for \(A_q(\mathcal{P})\). We use Euclidean distance and write \(\operatorname{diam}(C)=\sup_{x,z\in C}\|x-z\|\).

Theorem: Suppose each cell \(C_j\) is convex, and \(m\) has continuous derivatives through order \(q+1\) on an open convex set containing the cells. Suppose there is a finite \(M\) such that, for every point \(z\) in that set and every vector \(v\), \[ |D^{q+1}m(z)[v,\ldots,v]|\le M\|v\|^{q+1}. \] Here \(D^{q+1}m(z)[v,\ldots,v]\) is the \((q+1)\)st derivative applied to \(v\) in each argument. Then \[ A_q(\mathcal{P})\le \frac{M^2}{((q+1)!)^2} \sum_{j=1}^{K}P(X\in C_j)\operatorname{diam}(C_j)^{2(q+1)}. \]

Proof. Choose an anchor \(a_j\in C_j\) for each cell. On \(C_j\), use the degree-\(q\) Taylor polynomial of \(m\) about \(a_j\), denoted \(T_{q,a_j}\). For \(x\in C_j\), set \(u=x-a_j\) and consider the one-variable function \(\phi(t)=m(a_j+tu)\), \(0\le t\le1\). Convexity ensures that the whole line segment lies in the region where the derivative assumptions hold. The one-variable Taylor formula with integral remainder gives \[ m(x)-T_{q,a_j}(x)=\frac{1}{q!}\int_0^1(1-t)^q\phi^{(q+1)}(t)\,dt. \] The chain rule gives \(\phi^{(q+1)}(t)=D^{q+1}m(a_j+tu)[u,\ldots,u]\). Thus its absolute value is at most \(M\|u\|^{q+1}\). Since \(\int_0^1(1-t)^q\,dt=1/(q+1)\), it follows that \[ |m(x)-T_{q,a_j}(x)|\le \frac{M}{(q+1)!}\|x-a_j\|^{q+1} \le \frac{M}{(q+1)!}\operatorname{diam}(C_j)^{q+1}. \] The function formed by using \(T_{q,a_j}\) on each cell is an admissible piecewise-polynomial predictor. Squaring the bound, integrating over each cell, and summing yields the stated upper bound for this candidate's error. The infimum over all admissible predictors cannot be larger. \(\square\)

For affine leaves, \(q=1\), the condition is a bound on the Hessian in every direction. If \(|D^2m(z)[v,v]|\le M\|v\|^2\), the pointwise Taylor remainder is at most \(M\|x-a_j\|^2/2\). Squaring introduces the coefficient \(M^2/4\), not \(M/4\) or \(M^2/16\). In one dimension, a sufficient condition is \(|m''(x)|\le M\).

Worked Example: A Quadratic Function on One Interval

Let \(m(x)=x^2\) on the cell \(C=[0,h]\), where \(h=1/2\), and use affine leaves. The second derivative is \(m''(x)=2\), so \(M=2\). The cell diameter is \(h\), and the one-dimensional theorem gives \[ A_1(\{C\})\le \frac{2^2}{2^2}h^4=h^4. \] For \(h=1/2\), this is \(A_1(\{C\})\le (1/2)^4=1/16=0.0625\), for any distribution of \(X\) supported on this cell.

The coefficient is \(2^2/2^2=1\); it is not \(1/4\). The Taylor candidate about the left endpoint \(a=0\) is \(T_{1,0}(x)=0\), and its residual is \(x^2\). Indeed, for all \(x\in[0,1/2]\), \(|x^2|\le h^2\), so its squared residual is at most \(h^4=1/16\). This checks the theorem's bound directly. If degree-two leaves are allowed instead, the single polynomial \(x^2\) represents \(m\) exactly, giving approximation error zero.

Worked Example: Sine Regression with Affine Leaves

Take \(m(x)=\sin x\) on \([0,1]\), and partition the interval into five cells of width \(h=0.2\). On this domain, \(|m''(x)|=|\!-\sin x|\le1\), so \(M=1\). Each cell has diameter \(0.2\). The affine-leaf bound on each cell, before weighting by its probability, is \[ \frac{M^2}{4}h^4=\frac{1}{4}(0.2)^4 =\frac{1}{4}(0.0016)=0.0004. \]

The total bound weights this quantity by the probability of each cell: \[ A_1(\mathcal{P})\le \sum_{j=1}^5P(X\in C_j)(0.0004)=0.0004, \] because the cell probabilities sum to one. No assumption that \(X\) is uniform is needed. The calculation illustrates the squared-error order: with bounded second derivative, affine Taylor approximation has pointwise error of order \(h^2\), and squared error of order \(h^4\).

Multivariate Cells and Diameter

The same argument applies in several dimensions. The derivative condition in the theorem measures curvature along every direction, while the cell diameter controls how far a point can lie from the Taylor anchor. For axis-aligned rectangular tree cells, the Euclidean diameter is the square root of the sum of squared side lengths. A long, narrow rectangle can therefore have a substantial diameter even if one of its sides is small.

Worked Example: A Quadratic Surface on a Rectangle

Consider \(m(x_1,x_2)=x_1^2+2x_2^2\) on \(C=[0,0.1]\times[0,0.2]\), with an affine leaf. Its Hessian is the constant matrix \[ H=\begin{pmatrix}2&0\\0&4\end{pmatrix}. \] For every vector \(v=(v_1,v_2)\), \(D^2m[v,v]=2v_1^2+4v_2^2\le4(v_1^2+v_2^2)\). Thus \(M=4\) is valid. The squared diameter is \(0.1^2+0.2^2=0.05\), so the bound for this cell is \[ A_1(\{C\})\le \frac{4^2}{4}(0.05)^2 =4(0.0025)=0.01. \]

For a direct check, the affine Taylor polynomial at \((0,0)\) is zero, and its residual is \(x_1^2+2x_2^2\). Its maximum on the rectangle is \(0.1^2+2(0.2)^2=0.09\). Its squared residual is therefore at most \(0.09^2=0.0081\), below the valid but looser bound \(0.01\). The theorem bounds a Taylor candidate; it does not claim that the bound is attained.

What Increasing Degree or Refining Cells Can Guarantee

The Taylor bound makes the role of degree explicit. Under its derivative condition, degree \(q\) gives a pointwise remainder of order \(\operatorname{diam}(C)^{q+1}\), and a squared-error bound of order \(\operatorname{diam}(C)^{2(q+1)}\), multiplied by a derivative-dependent constant. This is an approximation statement, not an automatic guarantee that a fitted tree will improve in practice: estimating more coefficients can require more data.

Proposition: For a fixed partition, \(A_{q+1}(\mathcal{P})\le A_q(\mathcal{P})\). If a partition \(\mathcal{P}'\) refines \(\mathcal{P}\), then \(A_q(\mathcal{P}')\le A_q(\mathcal{P})\).

Proof. Every polynomial of degree at most \(q\) is also a polynomial of degree at most \(q+1\). Thus every predictor admissible for \(A_q(\mathcal{P})\) is admissible for \(A_{q+1}(\mathcal{P})\), so taking the infimum over the larger class cannot increase the error. For refinement, take any degree-\(q\) predictor on \(\mathcal{P}\) and restrict its polynomial on each original cell to each of the smaller cells in \(\mathcal{P}'\). The restricted functions remain degree at most \(q\), and the resulting predictor has exactly the same predictions, hence the same error. Taking infima proves the second inequality. \(\square\)

The proposition concerns the best approximation in a class. It does not say that estimated predictions have lower prediction error after increasing degree or refining a tree. The enlarged class can be harder to estimate from finite data. Separating approximation from estimation is essential when interpreting the Taylor bound.

Common Mistake: Losing the Squared Remainder Constant

A frequent error is to correctly obtain a Taylor remainder bound \(M h^2/2\) for affine leaves, then report \(M h^4/4\) or \(M^2h^4/4\) incorrectly after squaring. The square must apply to the entire coefficient: \[ \left(\frac{M}{2}h^2\right)^2=\frac{M^2}{4}h^4. \] For \(m(x)=x^2\), \(M=2\), so the coefficient is \(2^2/4=1\), and the bound is \(h^4\). It is not \(h^4/4\). Another mistake is to use cell width as though it were a radius around the Taylor anchor. The theorem uses \(\|x-a\|\le\operatorname{diam}(C)\); a smaller radius can be used only when it is verified for the chosen anchor and cell.

Key takeaway: Choose a Taylor polynomial on each cell, bound its remainder using a derivative bound and the cell diameter, then square and average. For degree-\(q\) leaves, the resulting squared approximation bound scales as cell diameter to the power \(2(q+1)\).

Check Your Understanding

Answer each question by identifying the approximation class and showing the relevant calculation.

  1. For affine leaves in one dimension, if \(|m''(x)|\le 3\) and a cell has diameter \(0.1\), what is the theorem's cellwise squared-error bound before multiplying by the cell probability?
  2. Why does the Taylor argument require the segment from the anchor to a point in the cell to remain in the region where the derivative condition holds?
  3. For degree-\(q\) leaves, what derivative order appears in the Taylor remainder, and what power of cell diameter appears in the squared bound?
  4. If a degree-two polynomial represents the regression function exactly on a cell, what is the approximation error on that cell?
  5. Does refining a partition guarantee that the error of a data-fitted tree decreases? Explain the difference between this claim and the proposition about best approximation.
Clinical Biostats