pub struct BoostingStep { /* private fields */ }alloc only.Expand description
A single step in the SGBT boosting sequence.
Owns a TreeSlot and applies variant-aware training repetition. The number
of training iterations per sample is determined by the caller (the ensemble
orchestrator computes train_count from the configured SGBT variant).
§Prediction semantics
Both train_and_predict and
predict return the active tree’s prediction
before any training on the current sample. This ensures unbiased
gradient computation in the boosting loop.
Implementations§
Source§impl BoostingStep
impl BoostingStep
Sourcepub fn new(tree_config: TreeConfig, detector: Box<dyn DriftDetector>) -> Self
pub fn new(tree_config: TreeConfig, detector: Box<dyn DriftDetector>) -> Self
Create a new boosting step with a fresh tree and drift detector.
Sourcepub fn new_with_max_samples(
tree_config: TreeConfig,
detector: Box<dyn DriftDetector>,
max_tree_samples: Option<u64>,
) -> Self
pub fn new_with_max_samples( tree_config: TreeConfig, detector: Box<dyn DriftDetector>, max_tree_samples: Option<u64>, ) -> Self
Create a new boosting step with optional time-based tree replacement.
Sourcepub fn new_with_graduated(
tree_config: TreeConfig,
detector: Box<dyn DriftDetector>,
max_tree_samples: Option<u64>,
shadow_warmup: usize,
) -> Self
pub fn new_with_graduated( tree_config: TreeConfig, detector: Box<dyn DriftDetector>, max_tree_samples: Option<u64>, shadow_warmup: usize, ) -> Self
Create a new boosting step with graduated tree handoff.
Sourcepub fn from_slot(slot: TreeSlot) -> Self
pub fn from_slot(slot: TreeSlot) -> Self
Reconstruct a boosting step from a pre-built tree slot.
Used during model deserialization.
Sourcepub fn train_and_predict(
&mut self,
features: &[f64],
gradient: f64,
hessian: f64,
train_count: usize,
) -> f64
pub fn train_and_predict( &mut self, features: &[f64], gradient: f64, hessian: f64, train_count: usize, ) -> f64
Train on a single sample with variant-aware repetition.
§Arguments
features- Input feature vector.gradient- Negative gradient of the loss at this sample.hessian- Second derivative (curvature) of the loss at this sample.train_count- Number of training iterations for this sample:0: skip training entirely (SK variant or stochastic skip).1: standard single-pass training.>1: multiple iterations (MI variant).
§Returns
The prediction from the active tree before training.
Sourcepub fn predict(&self, features: &[f64]) -> f64
pub fn predict(&self, features: &[f64]) -> f64
Predict without training.
Routes the feature vector through the active tree and returns the leaf value. Does not update any state.
Sourcepub fn predict_with_variance(&self, features: &[f64]) -> (f64, f64)
pub fn predict_with_variance(&self, features: &[f64]) -> (f64, f64)
Predict with variance for confidence estimation.
Returns (leaf_value, variance) where variance = 1 / (H_sum + lambda).
Sourcepub fn predict_smooth(&self, features: &[f64], bandwidth: f64) -> f64
pub fn predict_smooth(&self, features: &[f64], bandwidth: f64) -> f64
Predict using sigmoid-blended soft routing for smooth interpolation.
See crate::tree::hoeffding::HoeffdingTree::predict_smooth for details.
Sourcepub fn predict_smooth_auto(&self, features: &[f64], bandwidths: &[f64]) -> f64
pub fn predict_smooth_auto(&self, features: &[f64], bandwidths: &[f64]) -> f64
Predict using per-feature auto-calibrated bandwidths.
Sourcepub fn predict_interpolated(&self, features: &[f64]) -> f64
pub fn predict_interpolated(&self, features: &[f64]) -> f64
Predict with parent-leaf linear interpolation.
Sourcepub fn predict_sibling_interpolated(
&self,
features: &[f64],
bandwidths: &[f64],
) -> f64
pub fn predict_sibling_interpolated( &self, features: &[f64], bandwidths: &[f64], ) -> f64
Predict with sibling-based interpolation for feature-continuous predictions.
Sourcepub fn predict_graduated(&self, features: &[f64]) -> f64
pub fn predict_graduated(&self, features: &[f64]) -> f64
Predict with graduated active-shadow blending.
Sourcepub fn predict_graduated_sibling_interpolated(
&self,
features: &[f64],
bandwidths: &[f64],
) -> f64
pub fn predict_graduated_sibling_interpolated( &self, features: &[f64], bandwidths: &[f64], ) -> f64
Predict with graduated blending + sibling interpolation.
Sourcepub fn n_samples_seen(&self) -> u64
pub fn n_samples_seen(&self) -> u64
Total samples the active tree has seen.
Sourcepub fn has_alternate(&self) -> bool
pub fn has_alternate(&self) -> bool
Whether the slot has an alternate tree being trained.
Trait Implementations§
Source§impl Clone for BoostingStep
impl Clone for BoostingStep
Source§fn clone(&self) -> BoostingStep
fn clone(&self) -> BoostingStep
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more