pub struct MulticlassSGBT { /* private fields */ }Available on crate feature
alloc only.Expand description
Multi-class SGBT using one-vs-rest committee of ensembles.
Each class gets its own SGBT<SoftmaxLoss> trained with softmax
(logistic per-class) loss. The concrete loss type is monomorphized
for each committee – no Box<dyn Loss> overhead.
Predictions are softmax-normalized across all class committees.
Implementations§
Source§impl MulticlassSGBT
impl MulticlassSGBT
Sourcepub fn new(config: SGBTConfig, n_classes: usize) -> Result<Self>
pub fn new(config: SGBTConfig, n_classes: usize) -> Result<Self>
Sourcepub fn train_one(&mut self, sample: &impl Observation)
pub fn train_one(&mut self, sample: &impl Observation)
Train on a single observation.
The observation’s target should be the class index as f64 (0.0, 1.0, 2.0, …).
Uses SampleRef internally to avoid cloning feature vectors for each
committee (N classes = 0 clones instead of N clones).
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_proba(&self, features: &[f64]) -> Vec<f64>
pub fn predict_proba(&self, features: &[f64]) -> Vec<f64>
Predict class probabilities via softmax normalization.
Returns a vector of length n_classes summing to ~1.0.
Sourcepub fn n_samples_seen(&self) -> u64
pub fn n_samples_seen(&self) -> u64
Total samples trained.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MulticlassSGBT
impl !RefUnwindSafe for MulticlassSGBT
impl Send for MulticlassSGBT
impl Sync for MulticlassSGBT
impl Unpin for MulticlassSGBT
impl UnsafeUnpin for MulticlassSGBT
impl !UnwindSafe for MulticlassSGBT
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
Mutably borrows from an owned value. Read more