pub struct NormalConjugate { /* private fields */ }Expand description
Normal prior for a normal likelihood with known observation variance.
Uses the precision (inverse variance) formulation for numerically stable Bayesian updates.
Implementations§
Source§impl NormalConjugate
impl NormalConjugate
Sourcepub fn new(prior_mu: f64, prior_var: f64, obs_var: f64) -> Result<Self>
pub fn new(prior_mu: f64, prior_var: f64, obs_var: f64) -> Result<Self>
Create a normal conjugate prior.
prior_mu: prior meanprior_var: prior variance (must be positive)obs_var: known observation variance (must be positive)
Sourcepub fn update_batch(&self, observations: &[f64]) -> Self
pub fn update_batch(&self, observations: &[f64]) -> Self
Update with a batch of observations.
Sourcepub fn posterior_mean(&self) -> f64
pub fn posterior_mean(&self) -> f64
Posterior mean.
Sourcepub fn posterior_variance(&self) -> f64
pub fn posterior_variance(&self) -> f64
Posterior variance.
Trait Implementations§
Source§impl Clone for NormalConjugate
impl Clone for NormalConjugate
Source§fn clone(&self) -> NormalConjugate
fn clone(&self) -> NormalConjugate
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 NormalConjugate
impl Debug for NormalConjugate
impl Copy for NormalConjugate
Auto Trait Implementations§
impl Freeze for NormalConjugate
impl RefUnwindSafe for NormalConjugate
impl Send for NormalConjugate
impl Sync for NormalConjugate
impl Unpin for NormalConjugate
impl UnsafeUnpin for NormalConjugate
impl UnwindSafe for NormalConjugate
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