Struct rv::ConjugateModel [−][src]
pub struct ConjugateModel<X, Fx, Pr> where
Fx: Rv<X> + HasSuffStat<X>,
Pr: ConjugatePrior<X, Fx>, { /* fields omitted */ }
Expand description
A wrapper for a complete conjugate model
Paramters
X
: The type of the data/observations to be modeled
Fx
: The type of the likelihood, f(x|θ)
Pr
: The type of the prior on the parameters of Fx
, π(θ)
Implementations
impl<X, Fx, Pr> ConjugateModel<X, Fx, Pr> where
Fx: Rv<X> + HasSuffStat<X>,
Pr: ConjugatePrior<X, Fx>,
[src]
impl<X, Fx, Pr> ConjugateModel<X, Fx, Pr> where
Fx: Rv<X> + HasSuffStat<X>,
Pr: ConjugatePrior<X, Fx>,
[src]Return the posterior distribution
Example
use std::sync::Arc; use rv::prelude::*; use rv::ConjugateModel; let flips: Vec<bool> = vec![true, false, true, false, false, false]; let pr = Arc::new(Beta::new(1.0, 1.0).unwrap()); let fx = Bernoulli::uniform(); let mut model = ConjugateModel::<bool, Bernoulli, Beta>::new(&fx, pr); model.observe_many(&flips); let post = model.posterior(); assert_eq!(post, Beta::new(3.0, 5.0).unwrap());
Trait Implementations
impl<X: Clone, Fx: Clone, Pr: Clone> Clone for ConjugateModel<X, Fx, Pr> where
Fx: Rv<X> + HasSuffStat<X>,
Pr: ConjugatePrior<X, Fx>,
Fx::Stat: Clone,
[src]
impl<X: Clone, Fx: Clone, Pr: Clone> Clone for ConjugateModel<X, Fx, Pr> where
Fx: Rv<X> + HasSuffStat<X>,
Pr: ConjugatePrior<X, Fx>,
Fx::Stat: Clone,
[src]impl<X: Debug, Fx: Debug, Pr: Debug> Debug for ConjugateModel<X, Fx, Pr> where
Fx: Rv<X> + HasSuffStat<X>,
Pr: ConjugatePrior<X, Fx>,
Fx::Stat: Debug,
[src]
impl<X: Debug, Fx: Debug, Pr: Debug> Debug for ConjugateModel<X, Fx, Pr> where
Fx: Rv<X> + HasSuffStat<X>,
Pr: ConjugatePrior<X, Fx>,
Fx::Stat: Debug,
[src]impl<X: PartialEq, Fx: PartialEq, Pr: PartialEq> PartialEq<ConjugateModel<X, Fx, Pr>> for ConjugateModel<X, Fx, Pr> where
Fx: Rv<X> + HasSuffStat<X>,
Pr: ConjugatePrior<X, Fx>,
Fx::Stat: PartialEq,
[src]
impl<X: PartialEq, Fx: PartialEq, Pr: PartialEq> PartialEq<ConjugateModel<X, Fx, Pr>> for ConjugateModel<X, Fx, Pr> where
Fx: Rv<X> + HasSuffStat<X>,
Pr: ConjugatePrior<X, Fx>,
Fx::Stat: PartialEq,
[src]This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
impl<X: PartialOrd, Fx: PartialOrd, Pr: PartialOrd> PartialOrd<ConjugateModel<X, Fx, Pr>> for ConjugateModel<X, Fx, Pr> where
Fx: Rv<X> + HasSuffStat<X>,
Pr: ConjugatePrior<X, Fx>,
Fx::Stat: PartialOrd,
[src]
impl<X: PartialOrd, Fx: PartialOrd, Pr: PartialOrd> PartialOrd<ConjugateModel<X, Fx, Pr>> for ConjugateModel<X, Fx, Pr> where
Fx: Rv<X> + HasSuffStat<X>,
Pr: ConjugatePrior<X, Fx>,
Fx::Stat: PartialOrd,
[src]This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
impl<X, Fx, Pr> Rv<X> for ConjugateModel<X, Fx, Pr> where
Fx: Rv<X> + HasSuffStat<X>,
Pr: ConjugatePrior<X, Fx>,
[src]
impl<X, Fx, Pr> Rv<X> for ConjugateModel<X, Fx, Pr> where
Fx: Rv<X> + HasSuffStat<X>,
Pr: ConjugatePrior<X, Fx>,
[src]impl<X, Fx, Pr> SuffStat<X> for ConjugateModel<X, Fx, Pr> where
Fx: Rv<X> + HasSuffStat<X>,
Pr: ConjugatePrior<X, Fx>,
[src]
impl<X, Fx, Pr> SuffStat<X> for ConjugateModel<X, Fx, Pr> where
Fx: Rv<X> + HasSuffStat<X>,
Pr: ConjugatePrior<X, Fx>,
[src]Assimilate several observations
Forget several observations
impl<X, Fx, Pr> StructuralPartialEq for ConjugateModel<X, Fx, Pr> where
Fx: Rv<X> + HasSuffStat<X>,
Pr: ConjugatePrior<X, Fx>,
[src]Auto Trait Implementations
impl<X, Fx, Pr> RefUnwindSafe for ConjugateModel<X, Fx, Pr> where
Pr: RefUnwindSafe,
X: RefUnwindSafe,
<Fx as HasSuffStat<X>>::Stat: RefUnwindSafe,
impl<X, Fx, Pr> Send for ConjugateModel<X, Fx, Pr> where
Pr: Send + Sync,
X: Send,
<Fx as HasSuffStat<X>>::Stat: Send,
impl<X, Fx, Pr> Sync for ConjugateModel<X, Fx, Pr> where
Pr: Send + Sync,
X: Sync,
<Fx as HasSuffStat<X>>::Stat: Sync,
impl<X, Fx, Pr> Unpin for ConjugateModel<X, Fx, Pr> where
X: Unpin,
<Fx as HasSuffStat<X>>::Stat: Unpin,
impl<X, Fx, Pr> UnwindSafe for ConjugateModel<X, Fx, Pr> where
Pr: RefUnwindSafe,
X: UnwindSafe,
<Fx as HasSuffStat<X>>::Stat: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
pub fn vzip(self) -> V