pub struct BayesianUpdate;Expand description
Conjugate Bayesian updates for standard distribution families.
Each method returns updated (posterior) hyperparameters given a prior and observed data.
Implementations§
Source§impl BayesianUpdate
impl BayesianUpdate
Sourcepub fn normal_normal(
prior_mean: f64,
prior_std: f64,
likelihood_std: f64,
data: &[f64],
) -> (f64, f64)
pub fn normal_normal( prior_mean: f64, prior_std: f64, likelihood_std: f64, data: &[f64], ) -> (f64, f64)
Normal-Normal conjugate update: known variance σ², Gaussian prior on μ.
Prior: μ ~ N(μ₀, τ₀²). Data: x_i ~ N(μ, σ²). Returns posterior (μ_n, τ_n).
Sourcepub fn beta_bernoulli(
prior_alpha: f64,
prior_beta: f64,
successes: u64,
total: u64,
) -> (f64, f64)
pub fn beta_bernoulli( prior_alpha: f64, prior_beta: f64, successes: u64, total: u64, ) -> (f64, f64)
Beta-Bernoulli conjugate update: Beta prior on p, Bernoulli observations.
Prior: p ~ Beta(α, β). Data: k successes out of n. Returns posterior (α’, β’).
Sourcepub fn gamma_poisson(
prior_shape: f64,
prior_rate: f64,
counts: &[u64],
) -> (f64, f64)
pub fn gamma_poisson( prior_shape: f64, prior_rate: f64, counts: &[u64], ) -> (f64, f64)
Gamma-Poisson conjugate update: Gamma prior on λ, Poisson observations.
Prior: λ ~ Gamma(α, β). Data: counts k_i. Returns posterior (α’, β’).
Trait Implementations§
Source§impl Clone for BayesianUpdate
impl Clone for BayesianUpdate
Source§fn clone(&self) -> BayesianUpdate
fn clone(&self) -> BayesianUpdate
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BayesianUpdate
impl RefUnwindSafe for BayesianUpdate
impl Send for BayesianUpdate
impl Sync for BayesianUpdate
impl Unpin for BayesianUpdate
impl UnsafeUnpin for BayesianUpdate
impl UnwindSafe for BayesianUpdate
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.