pub trait StreamingTree: Send + Sync {
// Required methods
fn train_one(&mut self, features: &[f64], gradient: f64, hessian: f64);
fn predict(&self, features: &[f64]) -> f64;
fn n_leaves(&self) -> usize;
fn n_samples_seen(&self) -> u64;
fn reset(&mut self);
// Provided methods
fn split_gains(&self) -> &[f64] { ... }
fn predict_with_variance(&self, features: &[f64]) -> (f64, f64) { ... }
}Available on crate feature
alloc only.Expand description
A streaming decision tree that trains incrementally.
Required Methods§
Sourcefn train_one(&mut self, features: &[f64], gradient: f64, hessian: f64)
fn train_one(&mut self, features: &[f64], gradient: f64, hessian: f64)
Train on a single gradient/hessian pair at the given feature vector.
Sourcefn n_samples_seen(&self) -> u64
fn n_samples_seen(&self) -> u64
Total samples seen since creation.
Provided Methods§
Sourcefn split_gains(&self) -> &[f64]
fn split_gains(&self) -> &[f64]
Accumulated split gains per feature for importance tracking.
Returns an empty slice if the tree hasn’t seen any features yet or the implementation doesn’t track split gains.
Sourcefn predict_with_variance(&self, features: &[f64]) -> (f64, f64)
fn predict_with_variance(&self, features: &[f64]) -> (f64, f64)
Predict the leaf value and its variance for confidence estimation.
Returns (leaf_value, variance) where variance = 1 / (H_sum + lambda).
A smaller variance indicates higher confidence in the leaf prediction.
Default implementation returns infinite variance (no confidence info).