pub struct BaggedSGBT<L: Loss = SquaredLoss> { /* private fields */ }alloc only.Expand description
Bagged (Oza) SGBT ensemble for variance reduction.
Each of the M bags is an independent SGBT<L> trained on a Poisson(1)-
weighted stream. Predictions are averaged across bags, reducing the
variance of the ensemble without increasing bias.
This implements SGB(Oza) from Gunasekara et al. (2025), the streaming analogue of Breiman’s bootstrap aggregation adapted for gradient boosted trees with Hoeffding-bound splits.
Implementations§
Source§impl BaggedSGBT<SquaredLoss>
impl BaggedSGBT<SquaredLoss>
Sourcepub fn new(config: SGBTConfig, n_bags: usize) -> Result<Self>
pub fn new(config: SGBTConfig, n_bags: usize) -> Result<Self>
Create a new bagged SGBT with squared loss (regression).
§Errors
Returns IrithyllError::InvalidConfig if n_bags < 1.
Source§impl<L: Loss + Clone> BaggedSGBT<L>
impl<L: Loss + Clone> BaggedSGBT<L>
Sourcepub fn with_loss(config: SGBTConfig, loss: L, n_bags: usize) -> Result<Self>
pub fn with_loss(config: SGBTConfig, loss: L, n_bags: usize) -> Result<Self>
Create a new bagged SGBT with a custom loss function.
Each bag receives a unique seed derived from the config seed, ensuring diverse tree structures across bags.
§Errors
Returns IrithyllError::InvalidConfig if n_bags < 1.
Sourcepub fn train_one(&mut self, sample: &impl Observation)
pub fn train_one(&mut self, sample: &impl Observation)
Train all bags on a single observation with Poisson(1) weighting.
For each bag, draws k ~ Poisson(1) and calls bag.train_one(sample)
k times. On average, each bag sees the sample once, but the randomness
creates diverse training sets across bags.
Sourcepub fn train_batch<O: Observation>(&mut self, samples: &[O])
pub fn train_batch<O: Observation>(&mut self, samples: &[O])
Train on a batch of observations.
Sourcepub fn predict(&self, features: &[f64]) -> f64
pub fn predict(&self, features: &[f64]) -> f64
Predict the raw output as the mean across all bags.
Sourcepub fn predict_transformed(&self, features: &[f64]) -> f64
pub fn predict_transformed(&self, features: &[f64]) -> f64
Predict with loss transform applied (e.g., sigmoid for logistic loss), averaged across bags.
Sourcepub fn n_samples_seen(&self) -> u64
pub fn n_samples_seen(&self) -> u64
Total samples seen.
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Whether the base prediction has been initialized for all bags.