Enum Distribution

Source
pub enum Distribution {
    Bernoulli(f64),
    Binomial(i64, f64),
    Normal(f64, f64),
    Gamma(f64, f64),
    Beta(f64, f64),
    LogNormal(f64, f64),
    Categorical(Vec<f64>),
    Dirichlet(Vec<f64>),
}
Expand description

Enum that uniquely discribes a given distribution.

Variants§

§

Bernoulli(f64)

A Bernoulli distribution with paramater p.

§

Binomial(i64, f64)

A Binomial distribution with paramaters n and p.

§

Normal(f64, f64)

A Normal distribution with paramaters mu and sigma.

§

Gamma(f64, f64)

A Gamma distribution with parameters alpha and beta.

§

Beta(f64, f64)

A Beta distribution with parameters alpha and beta.

§

LogNormal(f64, f64)

A Lognormal distribution with paramaters mu and sigma.

§

Categorical(Vec<f64>)

A Categorical distribution with weights equal to p.

§

Dirichlet(Vec<f64>)

A Dirichlet distribution that returns a vector of degree n.

Trait Implementations§

Source§

impl Debug for Distribution

Source§

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

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

impl Sampleable for Distribution

Source§

fn sample(&self) -> Value

Sample from the distribution and return the value sampled.

Source§

fn liklihood(&self, value: &Value) -> Result<f64, &str>

Compute the liklihood of a value given a distribution (returns the log liklihood.)

§Errors

This function will return an Err if you try to determine the liklihood of a variant of the Value enum that the distribution does not produce. For example, trying to get the liklihood of a real number from a bernoulli distribution will return an Err.

Auto Trait Implementations§

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<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

Source§

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§

unsafe 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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