pub struct HeightPredictor { /* private fields */ }Expand description
Bayesian height predictor with conformal bounds.
Implementations§
Source§impl HeightPredictor
impl HeightPredictor
Sourcepub fn new(config: PredictorConfig) -> Self
pub fn new(config: PredictorConfig) -> Self
Create a new predictor with default config.
Sourcepub fn register_category(&mut self) -> usize
pub fn register_category(&mut self) -> usize
Register a new category. Returns the category id.
Sourcepub fn predict(&self, category: usize) -> HeightPrediction
pub fn predict(&self, category: usize) -> HeightPrediction
Predict height for an item in the given category.
Sourcepub fn observe(&mut self, category: usize, actual_height: u16) -> bool
pub fn observe(&mut self, category: usize, actual_height: u16) -> bool
Record an actual measured height, updating the model. Returns whether the measurement was within the predicted bounds.
Sourcepub fn posterior_mean(&self, category: usize) -> f64
pub fn posterior_mean(&self, category: usize) -> f64
Get the posterior mean for a category.
Sourcepub fn posterior_variance(&self, category: usize) -> f64
pub fn posterior_variance(&self, category: usize) -> f64
Get the posterior variance for a category.
Sourcepub fn total_measurements(&self) -> u64
pub fn total_measurements(&self) -> u64
Total measurements observed.
Sourcepub fn total_violations(&self) -> u64
pub fn total_violations(&self) -> u64
Total bound violations.
Sourcepub fn violation_rate(&self) -> f64
pub fn violation_rate(&self) -> f64
Empirical violation rate.
Sourcepub fn category_count(&self) -> usize
pub fn category_count(&self) -> usize
Number of categories.
Sourcepub fn category_observations(&self, category: usize) -> u64
pub fn category_observations(&self, category: usize) -> u64
Number of observations for a category.
Trait Implementations§
Source§impl Clone for HeightPredictor
impl Clone for HeightPredictor
Source§fn clone(&self) -> HeightPredictor
fn clone(&self) -> HeightPredictor
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HeightPredictor
impl Debug for HeightPredictor
Auto Trait Implementations§
impl Freeze for HeightPredictor
impl RefUnwindSafe for HeightPredictor
impl Send for HeightPredictor
impl Sync for HeightPredictor
impl Unpin for HeightPredictor
impl UnwindSafe for HeightPredictor
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