pub struct TreeConfig {Show 14 fields
pub max_depth: usize,
pub n_bins: usize,
pub lambda: f64,
pub gamma: f64,
pub grace_period: usize,
pub delta: f64,
pub feature_subsample_rate: f64,
pub seed: u64,
pub leaf_decay_alpha: Option<f64>,
pub split_reeval_interval: Option<usize>,
pub feature_types: Option<Vec<FeatureType>>,
pub gradient_clip_sigma: Option<f64>,
pub monotone_constraints: Option<Vec<i8>>,
pub leaf_model_type: LeafModelType,
}Expand description
Configuration for a single streaming decision tree.
These parameters control tree growth, regularization, and the statistical confidence required before committing a split decision.
§Defaults
| Parameter | Default |
|---|---|
max_depth | 6 |
n_bins | 64 |
lambda | 1.0 |
gamma | 0.0 |
grace_period | 200 |
delta | 1e-7 |
feature_subsample_rate | 1.0 |
Fields§
§max_depth: usizeMaximum tree depth. Deeper trees capture more interactions but risk overfitting on streaming data. Default: 6.
n_bins: usizeNumber of histogram bins per feature. More bins give finer split resolution at the cost of memory and slower convergence. Default: 64.
lambda: f64L2 regularization parameter (lambda). Penalizes large leaf weights, helping prevent overfitting. Appears in the denominator of the leaf weight formula: w = -G / (H + lambda). Default: 1.0.
gamma: f64Minimum split gain threshold (gamma). A candidate split must achieve gain > gamma to be accepted. Higher values produce more conservative trees. Default: 0.0.
grace_period: usizeMinimum number of samples a leaf must accumulate before evaluating potential splits. Also controls when bin edges are computed from observed feature values. Default: 200.
delta: f64Hoeffding bound confidence parameter (delta). Smaller values require more statistical evidence before committing a split, producing more conservative but more reliable trees. The bound guarantees that the chosen split is within epsilon of optimal with probability 1-delta. Default: 1e-7.
feature_subsample_rate: f64Fraction of features to consider at each split evaluation. 1.0 means all features are evaluated; smaller values introduce randomness (similar to random forest feature bagging). Default: 1.0.
seed: u64Random seed for feature subsampling. Default: 42.
Set by the ensemble orchestrator to ensure deterministic, diverse
behavior across trees (typically config.seed ^ step_index).
leaf_decay_alpha: Option<f64>Per-sample decay factor for leaf statistics.
Computed from leaf_half_life as exp(-ln(2) / half_life).
When Some(alpha), leaf gradient/hessian sums and histogram bins
are decayed by alpha before each new accumulation.
None (default) means no decay.
split_reeval_interval: Option<usize>Re-evaluation interval for max-depth leaves.
When Some(n), leaves at max depth will re-evaluate potential splits
every n samples, allowing the tree to adapt its structure over time.
None (default) disables re-evaluation.
feature_types: Option<Vec<FeatureType>>Per-feature type declarations (continuous vs categorical).
When Some, categorical features use one-bin-per-category binning and
Fisher optimal binary partitioning. None (default) treats all features
as continuous.
gradient_clip_sigma: Option<f64>Per-leaf gradient clipping threshold in standard deviations.
When Some(sigma), leaf-level EWMA gradient statistics are tracked and
incoming gradients are clamped to mean ± sigma * std_dev.
None (default) disables clipping.
monotone_constraints: Option<Vec<i8>>Per-feature monotonic constraints: +1 = increasing, -1 = decreasing, 0 = free.
Candidate splits violating monotonicity are rejected.
None (default) means no constraints.
leaf_model_type: LeafModelTypeLeaf prediction model type.
Controls how each leaf computes its prediction:
ClosedForm(default): constant leaf weightw = -G / (H + lambda).Linear: online ridge regression with AdaGrad optimization, learning a localw . x + bsurface. Optionaldecayfor concept drift. Recommended for low-depth trees (depth 2–4).MLP: single hidden layer neural network per leaf. Optionaldecayfor concept drift.Adaptive: starts as closed-form, auto-promotes to a more complex model when the Hoeffding bound (usingdelta) confirms it is statistically superior. No arbitrary thresholds.
Implementations§
Source§impl TreeConfig
impl TreeConfig
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new TreeConfig with default parameters.
Equivalent to TreeConfig::default(), but provided as a named
constructor for clarity in builder chains.
Sourcepub fn grace_period(self, grace_period: usize) -> Self
pub fn grace_period(self, grace_period: usize) -> Self
Set the grace period (minimum samples before evaluating splits).
Sourcepub fn feature_subsample_rate(self, rate: f64) -> Self
pub fn feature_subsample_rate(self, rate: f64) -> Self
Set the feature subsample rate.
Sourcepub fn leaf_decay_alpha(self, alpha: f64) -> Self
pub fn leaf_decay_alpha(self, alpha: f64) -> Self
Set the per-sample decay factor for leaf statistics.
Sourcepub fn leaf_decay_alpha_opt(self, alpha: Option<f64>) -> Self
pub fn leaf_decay_alpha_opt(self, alpha: Option<f64>) -> Self
Optionally set the per-sample decay factor for leaf statistics.
Sourcepub fn split_reeval_interval(self, interval: usize) -> Self
pub fn split_reeval_interval(self, interval: usize) -> Self
Set the re-evaluation interval for max-depth leaves.
Sourcepub fn split_reeval_interval_opt(self, interval: Option<usize>) -> Self
pub fn split_reeval_interval_opt(self, interval: Option<usize>) -> Self
Optionally set the re-evaluation interval for max-depth leaves.
Sourcepub fn feature_types(self, types: Vec<FeatureType>) -> Self
pub fn feature_types(self, types: Vec<FeatureType>) -> Self
Set the per-feature type declarations.
Sourcepub fn feature_types_opt(self, types: Option<Vec<FeatureType>>) -> Self
pub fn feature_types_opt(self, types: Option<Vec<FeatureType>>) -> Self
Optionally set the per-feature type declarations.
Sourcepub fn gradient_clip_sigma(self, sigma: f64) -> Self
pub fn gradient_clip_sigma(self, sigma: f64) -> Self
Set the gradient clipping threshold in standard deviations.
Sourcepub fn gradient_clip_sigma_opt(self, sigma: Option<f64>) -> Self
pub fn gradient_clip_sigma_opt(self, sigma: Option<f64>) -> Self
Optionally set the gradient clipping threshold.
Sourcepub fn monotone_constraints(self, constraints: Vec<i8>) -> Self
pub fn monotone_constraints(self, constraints: Vec<i8>) -> Self
Set per-feature monotonic constraints.
Sourcepub fn monotone_constraints_opt(self, constraints: Option<Vec<i8>>) -> Self
pub fn monotone_constraints_opt(self, constraints: Option<Vec<i8>>) -> Self
Optionally set per-feature monotonic constraints.
Sourcepub fn leaf_model_type(self, lmt: LeafModelType) -> Self
pub fn leaf_model_type(self, lmt: LeafModelType) -> Self
Set the leaf prediction model type.
LeafModelType::Linear is recommended for low-depth configurations
(depth 2–4) where per-leaf linear models significantly reduce
approximation error compared to constant leaves.
LeafModelType::Adaptive automatically selects between closed-form and
a trainable model per leaf, using the Hoeffding bound for promotion.
Trait Implementations§
Source§impl Clone for TreeConfig
impl Clone for TreeConfig
Source§fn clone(&self) -> TreeConfig
fn clone(&self) -> TreeConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TreeConfig
impl Debug for TreeConfig
Auto Trait Implementations§
impl Freeze for TreeConfig
impl RefUnwindSafe for TreeConfig
impl Send for TreeConfig
impl Sync for TreeConfig
impl Unpin for TreeConfig
impl UnsafeUnpin for TreeConfig
impl UnwindSafe for TreeConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more