ML.Tree
Roll-up: finite-partition (piecewise-constant) tree predictors and random-forest averaging, with the structural range-preservation property.
FinitePartitionPredictor 3 core · 0 supporting A regression tree, abstracted to its essential structure: a finite set of cells, a map sending each input to its cell, and a value per cell. ★ FinitePartitionPredictor★ eval_eqOn_cell
Finite-partition predictors (regression trees)
A regression tree, abstracted to its essential structure: a finite set of cells, a map sending each input to its cell, and a value per cell. The predictor is piecewise constant on the cells. (CART greediness, splits, and bootstrap are out of scope; this is the structural target a tree compiles to.)
A piecewise-constant predictor on a finite partition: a finite index type cell of partition cells, a map chooseCell assigning each input to its cell, and a constant predicted value value on each cell.
Definition (Lean source)
The tree prediction: the value of the cell the input falls into.
Definition (Lean source)
For a finite-partition predictor T, on the set of inputs mapped to a given cell c, the predictor's output equals the constant value assigned to that cell.
Formal statement
Proof (Lean source)
Forest 3 core · 0 supporting This file models a random forest as a fixed-size finite ensemble of FinitePartitionPredictors over an input type X. ★ RandomForest★ eval_mem_Icc
Random forests
This file models a random forest as a fixed-size finite ensemble of
FinitePartitionPredictors over an input type X. The public API consists of
RandomForest, which stores one tree for each index in Fin T, and
RandomForest.eval, the uniform average of the tree predictions.
The main structural theorem, RandomForest.eval_mem_Icc, states that a nonempty
forest preserves pointwise interval bounds: if every tree prediction lies in
[a, b] at every input, then the averaged forest prediction also lies in
[a, b].
A random forest: one finite-partition regression tree tree for each index in Fin T.
Definition (Lean source)
The forest prediction: the average of the tree predictions.
Definition (Lean source)
For a random forest F of T finite-partition regression trees, if the forest is nonempty (T > 0) and every tree predicts within [a, b] at every input, then the forest's averaged prediction also lies in [a, b] at every input x.