Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Decision trees

solow-tree provides CART decision trees for classification and regression with Gini, entropy, MSE, and MAE splitters, and Extra-Tree variants with fully-randomized thresholds. Deterministic tie-breaking. Arena-stored nodes.

Estimators

EstimatorWhat it does
DecisionTreeClassifierCART classifier with Gini or Entropy splitters, class weights, deterministic tie-breaking.
DecisionTreeRegressorCART regressor with Mse or Mae splitters. Uses running mean and variance updates for O(n log n) split search.
ExtraTreeClassifierFully-randomized classifier tree: chooses a random threshold rather than searching for the best.
ExtraTreeRegressorExtra-random regression tree variant.

TreeParams controls

FieldPurpose
max_depthMaximum tree depth. None for unlimited.
min_samples_splitMinimum samples to split an internal node.
min_samples_leafMinimum samples per leaf.
min_impurity_decreaseMinimum impurity drop for a split to be accepted.
max_leaf_nodesBest-first growth cap on leaves.
max_featuresNumber of features considered at each split.
seedDeterministic MMIX-LCG for feature subsampling and tie-breaking.

Example

#![allow(unused)]
fn main() {
use solow_tree::{DecisionTreeRegressor, RegressionCriterion, TreeParams};

let tree = DecisionTreeRegressor::new(
    RegressionCriterion::Mse,
    TreeParams::new()
        .max_depth(Some(10))
        .min_samples_split(2)
        .seed(42),
).fit(&x, &y)?;

let pred = tree.predict(&x_test)?;
Ok::<_, solow_core::Error>(())
}

Correctness

Cross-verified against committed golden reference fixtures. Deterministic tie-breaking: identical inputs produce identical trees across runs and platforms under a fixed seed.