pub enum Prior {
Uniform {
low: f64,
high: f64,
},
Gaussian {
mean: f64,
std: f64,
},
Laplace {
mu: f64,
b: f64,
},
Jeffreys,
Dirichlet {
alpha: Vec<f64>,
},
Beta {
alpha: f64,
beta: f64,
},
Gamma {
shape: f64,
rate: f64,
},
}Expand description
Supported prior distribution families.
Variants§
Uniform
Uniform prior on [low, high].
Gaussian
Gaussian (normal) prior N(mean, std²).
Laplace
Laplace (double-exponential) prior with location μ and scale b.
Jeffreys
Jeffreys (improper) scale prior ∝ 1/θ for θ > 0.
Dirichlet
Dirichlet prior over a simplex with concentration parameters α.
Beta
Beta prior Beta(alpha, beta) on [0, 1].
Gamma
Gamma prior Gamma(shape, rate) on (0, ∞).
Implementations§
Source§impl Prior
impl Prior
Sourcepub fn log_density(&self, theta: f64) -> f64
pub fn log_density(&self, theta: f64) -> f64
Returns the log prior density log p(θ) for a scalar parameter θ.
Returns f64::NEG_INFINITY when θ is outside the support.
Sourcepub fn dirichlet_log_density(&self, x: &[f64]) -> f64
pub fn dirichlet_log_density(&self, x: &[f64]) -> f64
Returns the log density of a Dirichlet prior for a probability vector x.
Returns f64::NEG_INFINITY when the dimensions do not match.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Prior
impl RefUnwindSafe for Prior
impl Send for Prior
impl Sync for Prior
impl Unpin for Prior
impl UnsafeUnpin for Prior
impl UnwindSafe for Prior
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.