Skip to main content

BoostingStep

Struct BoostingStep 

Source
pub struct BoostingStep { /* private fields */ }
Available on crate feature 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

Source

pub fn new(tree_config: TreeConfig, detector: Box<dyn DriftDetector>) -> Self

Create a new boosting step with a fresh tree and drift detector.

Source

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.

Source

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.

Source

pub fn from_slot(slot: TreeSlot) -> Self

Reconstruct a boosting step from a pre-built tree slot.

Used during model deserialization.

Source

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.

Source

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.

Source

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).

Source

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.

Source

pub fn predict_smooth_auto(&self, features: &[f64], bandwidths: &[f64]) -> f64

Predict using per-feature auto-calibrated bandwidths.

Source

pub fn predict_interpolated(&self, features: &[f64]) -> f64

Predict with parent-leaf linear interpolation.

Source

pub fn predict_sibling_interpolated( &self, features: &[f64], bandwidths: &[f64], ) -> f64

Predict with sibling-based interpolation for feature-continuous predictions.

Source

pub fn predict_graduated(&self, features: &[f64]) -> f64

Predict with graduated active-shadow blending.

Source

pub fn predict_graduated_sibling_interpolated( &self, features: &[f64], bandwidths: &[f64], ) -> f64

Predict with graduated blending + sibling interpolation.

Source

pub fn n_leaves(&self) -> usize

Number of leaves in the active tree.

Source

pub fn n_samples_seen(&self) -> u64

Total samples the active tree has seen.

Source

pub fn has_alternate(&self) -> bool

Whether the slot has an alternate tree being trained.

Source

pub fn reset(&mut self)

Reset to a completely fresh state: new tree, no alternate, reset detector.

Source

pub fn slot(&self) -> &TreeSlot

Immutable access to the underlying TreeSlot.

Source

pub fn slot_mut(&mut self) -> &mut TreeSlot

Mutable access to the underlying TreeSlot.

Trait Implementations§

Source§

impl Clone for BoostingStep

Source§

fn clone(&self) -> BoostingStep

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BoostingStep

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.