Struct bio::stats::bayesian::model::Model

source ·
pub struct Model<L, Pr, Po, Payload = ()>
where L: Likelihood<Payload>, Pr: Prior, Po: Posterior, Payload: Default,
{ /* private fields */ }
Expand description

Bayesian model, consisting of a prior, a posterior and a likelihood model. Thereby, Payload is a custom payload of the model instance. This can be used to define custom caching mechanisms. See here for an example.

Implementations§

source§

impl<Event, PosteriorEvent, Data, L, Pr, Po, Payload> Model<L, Pr, Po, Payload>
where Payload: Default, Event: Hash + Eq + Clone, PosteriorEvent: Hash + Eq + Clone, L: Likelihood<Payload, Event = Event, Data = Data>, Pr: Prior<Event = Event>, Po: Posterior<BaseEvent = Event, Event = PosteriorEvent, Data = Data>,

source

pub fn new(likelihood: L, prior: Pr, posterior: Po) -> Self

Create new instance.

source

pub fn likelihood(&self) -> &L

source

pub fn likelihood_mut(&mut self) -> &mut L

source

pub fn prior(&self) -> &Pr

source

pub fn prior_mut(&mut self) -> &mut Pr

source

pub fn posterior(&self) -> &Po

source

pub fn posterior_mut(&mut self) -> &mut Po

source

pub fn compute<U: IntoIterator<Item = PosteriorEvent>>( &self, universe: U, data: &Data ) -> ModelInstance<Event, PosteriorEvent>

Compute model for a given universe of events.

source

pub fn compute_from_marginal<M>( &self, marginal: &M, data: &Data ) -> ModelInstance<Event, PosteriorEvent>
where M: Marginal<Data = Data, Event = PosteriorEvent, BaseEvent = Event>,

Compute model via the exploration of the marginal distribution of the data.

Trait Implementations§

source§

impl<L, Pr, Po, Payload> Clone for Model<L, Pr, Po, Payload>
where L: Likelihood<Payload> + Clone, Pr: Prior + Clone, Po: Posterior + Clone, Payload: Default + Clone,

source§

fn clone(&self) -> Model<L, Pr, Po, Payload>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<L, Pr, Po, Payload> Debug for Model<L, Pr, Po, Payload>
where L: Likelihood<Payload> + Debug, Pr: Prior + Debug, Po: Posterior + Debug, Payload: Default + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<L, Pr, Po, Payload> Default for Model<L, Pr, Po, Payload>
where L: Likelihood<Payload> + Default, Pr: Prior + Default, Po: Posterior + Default, Payload: Default + Default,

source§

fn default() -> Model<L, Pr, Po, Payload>

Returns the “default value” for a type. Read more
source§

impl<'de, L, Pr, Po, Payload> Deserialize<'de> for Model<L, Pr, Po, Payload>
where L: Likelihood<Payload> + Deserialize<'de>, Pr: Prior + Deserialize<'de>, Po: Posterior + Deserialize<'de>, Payload: Default,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<L, Pr, Po, Payload> Hash for Model<L, Pr, Po, Payload>
where L: Likelihood<Payload> + Hash, Pr: Prior + Hash, Po: Posterior + Hash, Payload: Default + Hash,

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<L, Pr, Po, Payload> Ord for Model<L, Pr, Po, Payload>
where L: Likelihood<Payload> + Ord, Pr: Prior + Ord, Po: Posterior + Ord, Payload: Default + Ord,

source§

fn cmp(&self, other: &Model<L, Pr, Po, Payload>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<L, Pr, Po, Payload> PartialEq for Model<L, Pr, Po, Payload>
where L: Likelihood<Payload> + PartialEq, Pr: Prior + PartialEq, Po: Posterior + PartialEq, Payload: Default + PartialEq,

source§

fn eq(&self, other: &Model<L, Pr, Po, Payload>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<L, Pr, Po, Payload> PartialOrd for Model<L, Pr, Po, Payload>
where L: Likelihood<Payload> + PartialOrd, Pr: Prior + PartialOrd, Po: Posterior + PartialOrd, Payload: Default + PartialOrd,

source§

fn partial_cmp(&self, other: &Model<L, Pr, Po, Payload>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<L, Pr, Po, Payload> Serialize for Model<L, Pr, Po, Payload>
where L: Likelihood<Payload> + Serialize, Pr: Prior + Serialize, Po: Posterior + Serialize, Payload: Default,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<L, Pr, Po, Payload> Copy for Model<L, Pr, Po, Payload>
where L: Likelihood<Payload> + Copy, Pr: Prior + Copy, Po: Posterior + Copy, Payload: Default + Copy,

source§

impl<L, Pr, Po, Payload> Eq for Model<L, Pr, Po, Payload>
where L: Likelihood<Payload> + Eq, Pr: Prior + Eq, Po: Posterior + Eq, Payload: Default + Eq,

source§

impl<L, Pr, Po, Payload> StructuralPartialEq for Model<L, Pr, Po, Payload>
where L: Likelihood<Payload>, Pr: Prior, Po: Posterior, Payload: Default,

Auto Trait Implementations§

§

impl<L, Pr, Po, Payload> Freeze for Model<L, Pr, Po, Payload>
where L: Freeze, Po: Freeze, Pr: Freeze,

§

impl<L, Pr, Po, Payload> RefUnwindSafe for Model<L, Pr, Po, Payload>

§

impl<L, Pr, Po, Payload> Send for Model<L, Pr, Po, Payload>
where L: Send, Payload: Send, Po: Send, Pr: Send,

§

impl<L, Pr, Po, Payload> Sync for Model<L, Pr, Po, Payload>
where L: Sync, Payload: Sync, Po: Sync, Pr: Sync,

§

impl<L, Pr, Po, Payload> Unpin for Model<L, Pr, Po, Payload>
where L: Unpin, Payload: Unpin, Po: Unpin, Pr: Unpin,

§

impl<L, Pr, Po, Payload> UnwindSafe for Model<L, Pr, Po, Payload>
where L: UnwindSafe, Payload: UnwindSafe, Po: UnwindSafe, Pr: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
source§

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

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<N> NodeTrait for N
where N: Copy + Ord + Hash,

source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,