pub enum Likelihood {
Gaussian {
data: Vec<f64>,
sigma: f64,
},
Poisson {
counts: Vec<u64>,
},
Bernoulli {
outcomes: Vec<u8>,
},
Multinomial {
counts: Vec<u64>,
},
}Expand description
Supported likelihood functions.
Variants§
Gaussian
Gaussian likelihood: x | μ, σ ~ N(μ, σ²).
Poisson
Poisson likelihood: k | λ ~ Poisson(λ).
Bernoulli
Bernoulli likelihood: x ∈ {0,1} | p ~ Bernoulli(p).
Multinomial
Multinomial likelihood over K categories.
Implementations§
Source§impl Likelihood
impl Likelihood
Sourcepub fn log_likelihood(&self, theta: f64) -> f64
pub fn log_likelihood(&self, theta: f64) -> f64
Returns the log likelihood log p(data | θ) for a scalar parameter θ.
For Gaussian: θ = μ (mean).
For Poisson: θ = λ (rate).
For Bernoulli: θ = p (probability).
For Multinomial: not applicable (returns NEG_INFINITY; use multinomial_log_likelihood).
Sourcepub fn multinomial_log_likelihood(&self, probs: &[f64]) -> f64
pub fn multinomial_log_likelihood(&self, probs: &[f64]) -> f64
Returns the log multinomial likelihood for probability vector probs.
Trait Implementations§
Source§impl Clone for Likelihood
impl Clone for Likelihood
Source§fn clone(&self) -> Likelihood
fn clone(&self) -> Likelihood
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 moreAuto Trait Implementations§
impl Freeze for Likelihood
impl RefUnwindSafe for Likelihood
impl Send for Likelihood
impl Sync for Likelihood
impl Unpin for Likelihood
impl UnsafeUnpin for Likelihood
impl UnwindSafe for Likelihood
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.