Truncating decision trees and the spectrum of small trees #
Cutting every path of a decision tree at length k gives a tree of depth at most k
(DecisionTree.truncate, DecisionTree.depth_truncate_le) that agrees with the original on the
inputs whose path has length at most k, and outputs none on the others
(DecisionTree.eval_truncate). When no path queries a coordinate twice
(DecisionTree.QueriesDistinct), as the book insists for decision trees
O'Donnell, Definition 3.13, a uniformly random input follows a path of length more
than k with probability at most s / 2 ^ (k + 1), for s the number of leaves
(DecisionTree.dens_lt_length_path_le): each node at depth k + 1 is reached with probability
2 ^ (-(k + 1)), and there are at most s of them. So the truncation differs from the tree on at
most that fraction of inputs (DecisionTree.dens_eval_truncate_ne_le), and on at most an ε
fraction when k = ⌊log₂ (s / ε)⌋ (DecisionTree.dens_eval_truncate_floor_logb_ne_le,
O'Donnell, Exercise 3.22). Without distinct queries the bound fails, but pruning
(DecisionTree.prune) turns any tree into one with no repeated query
(DecisionTree.queriesDistinctFrom_prune) and no more leaves (DecisionTree.leafCount_prune_le)
that computes the same function. So for any tree t with s = t.leafCount, the bounds hold for
(t.prune PartialAssignment.empty).truncate k against t.eval; they need not hold for
t.truncate k itself, which can err on more inputs when t repeats a query.
Giving the new leaves the value 0, a function of a decision tree with s leaves and values in
[-1, 1] is within squared L² distance s / 2 ^ (k + 1) of a function of degree at most k,
so its Fourier weight above degree k is at most s / 2 ^ (k + 1)
(DecisionTree.sum_fourierCoeff_sq_le_leafCount_div), for any decision tree, by pruning first.
Hence it is ε-concentrated on degree up to log₂ (s / ε)
(DecisionTree.sum_fourierCoeff_sq_logb_lt_card_le)
O'Donnell, Proposition 3.17 and Exercise 3.22.
Deviations from the book. The book's functions are {-1, 1}-valued and its trees never repeat a
query, so its size is the number of reachable leaves; here the values lie in [-1, 1], any tree is
allowed, s is the structural leaf count DecisionTree.leafCount, which also counts unreachable
leaves, and any ε > 0 is allowed rather than ε ∈ (0, 1]. Exercise 3.22 labels the new leaves
±1; here they are none, so closeness says the truncation outputs some (t.eval x), and any
±1 labelling errs on at most the same inputs. For the Fourier bound the new leaves are valued 0
rather than ±1, which saves a factor 4 in the squared L² distance.
Usage #
Open Cslib.DecisionTree. The hypothesis QueriesDistinct t of the truncation bounds is
QueriesDistinctFrom ∅ t, a conjunction over the nodes that simp [QueriesDistinctFrom] decides
for a concrete tree. For any tree t, queriesDistinctFrom_prune gives it for the pruned tree
t' = t.prune PartialAssignment.empty. The bounds then concern t'.truncate k:
DecisionTree.eval_prune_empty replaces t'.eval by the original t.eval, and
leafCount_prune_le replaces t'.leafCount by the original t.leafCount in the upper bound, so
t'.truncate k fails to output some (t.eval x) on at most a t.leafCount / 2 ^ (k + 1) fraction
of inputs. This says nothing about t.truncate k: the repeated-query chain in the tests below
has five leaves, yet its truncation at length 3 errs on half the inputs, more than 5 / 2 ^ 4.
The Fourier bounds need no such hypothesis. A Boolean tree t : DecisionTree ι Bool enters them
with g = signVal, as fun x => signVal (t.eval x), and |signVal b| ≤ 1 is by simp. With
s = t.leafCount, the weight above degree k is at most s / 2 ^ (k + 1)
(DecisionTree.sum_fourierCoeff_sq_le_leafCount_div), which is the form the low-degree algorithm
uses (UniformLearning.lowDegreeLearner_learns_decisionTreeClass). The checked client
CslibFrontierTests/DecisionTreeTruncate.lean
works the conjunction of two bits, a tree with three leaves whose truncation at length one errs on
exactly half the inputs and whose weight above degree one is exactly 1 / 4; the conjunction of
three bits at ε = 3 / 4, where Exercise 3.22 cuts at length 2 with error 1 / 4 and
Proposition 3.17 counts only the degree-3 weight 1 / 16; and a chain that repeats one query,
whose long paths and truncation break the bounds while its pruned tree meets them.
Main definitions #
Cslib.DecisionTree.truncate: cut every path at lengthk.
Main results #
Cslib.DecisionTree.eval_truncate: the truncation agrees with the tree on short paths.Cslib.DecisionTree.dens_lt_length_path_le: long paths are rare.Cslib.DecisionTree.dens_eval_truncate_ne_le: the truncation at lengthkerrs on at most as / 2 ^ (k + 1)fraction of inputs, the general-kbound behind Exercise 3.22.Cslib.DecisionTree.dens_eval_truncate_floor_logb_ne_le: Exercise 3.22, the truncation at⌊log₂ (s / ε)⌋isε-close to the tree.Cslib.DecisionTree.sum_fourierCoeff_sq_le_leafCount_div,Cslib.DecisionTree.sum_fourierCoeff_sq_logb_lt_card_le: small decision trees have spectra concentrated on low degree.
References #
Cut every path of a decision tree at length k: the nodes at depth k become leaves labelled
none, and the original leaves b above them become some b.
A truncated tree has depth at most the cut.
A truncated tree agrees with the original on short paths: it outputs some (t.eval x)
when the path of x has length at most k, and none otherwise.
Long paths are rare: in a decision tree with s leaves whose paths never repeat a query,
a uniformly random input follows a path of length more than k with probability at most
s / 2 ^ (k + 1).
A truncated tree is close to the original: in a decision tree with s leaves whose paths
never repeat a query, the truncation at length k fails to output some (t.eval x) on at most a
s / 2 ^ (k + 1) fraction of inputs. This is the general-k bound behind
O'Donnell, Exercise 3.22, which is the case k = ⌊log₂ (s / ε)⌋
(DecisionTree.dens_eval_truncate_floor_logb_ne_le).
Exercise 3.22: in a decision tree with s leaves whose paths never repeat a query,
cutting the paths at length ⌊log₂ (s / ε)⌋ gives a tree that outputs some (t.eval x) on all
but an ε fraction of inputs, for any ε > 0 O'Donnell, Exercise 3.22. The book
labels the new leaves ±1 and takes ε ∈ (0, 1]. A tree t that repeats queries enters through
its pruned tree t.prune PartialAssignment.empty, which computes t.eval with at most
t.leafCount leaves: the conclusion is then about the truncation of the pruned tree, compared
against t.eval, and does not hold in general for the truncation of t itself.
Small decision trees have little high-degree weight: a function of a decision tree with
s leaves, with values in [-1, 1], has Fourier weight at most s / 2 ^ (k + 1) above
degree k. Here s = t.leafCount, which also counts unreachable leaves, and the tree may repeat
queries.
A small decision tree is concentrated on low degree: a function of a decision tree with
s leaves, with values in [-1, 1], is ε-concentrated on degree up to log₂ (s / ε), for any
ε > 0 O'Donnell, Proposition 3.17. Here s = t.leafCount, which also counts
unreachable leaves. The book takes {-1, 1} values, trees without repeated queries and
ε ∈ (0, 1].