[][src]Struct rv::dist::SymmetricDirichlet

pub struct SymmetricDirichlet { /* fields omitted */ }

Symmetric Dirichlet distribution where all alphas are the same.

SymmetricDirichlet { alpha, k } is mathematicall equivalent to Dirichlet { alphas: vec![alpha; k] }. This version has some extra optimizations to seep up computing the PDF and drawing random vectors.

Methods

impl SymmetricDirichlet[src]

pub fn set_alpha(&mut self, val: f64) -> &mut Self[src]

impl SymmetricDirichlet[src]

pub fn new(alpha: f64, k: usize) -> Result<Self, DirichletError>[src]

Create a new symmetric Dirichlet distributon

Arguments

  • alpha: The Dirichlet weight.
  • k : The number of weights. alpha will be replicated k times.

pub fn new_unchecked(alpha: f64, k: usize) -> Self[src]

Create a new SymmetricDirichlet without checking whether the parmaeters are valid.

pub fn jeffreys(k: usize) -> Result<Self, DirichletError>[src]

The Jeffrey's Dirichlet prior for Categorical distributions

Example

let symdir = SymmetricDirichlet::jeffreys(4).unwrap();
assert_eq!(symdir, SymmetricDirichlet::new(0.5, 4).unwrap());

pub fn alpha(&self) -> f64[src]

Get the alpha unfiorm weight parameter

Example

let symdir = SymmetricDirichlet::new(1.2, 5).unwrap();
assert_eq!(symdir.alpha(), 1.2);

pub fn k(&self) -> usize[src]

Get the number of weights, k

Example

let symdir = SymmetricDirichlet::new(1.2, 5).unwrap();
assert_eq!(symdir.k(), 5);

Trait Implementations

impl Clone for SymmetricDirichlet[src]

impl<X: CategoricalDatum> ConjugatePrior<X, Categorical> for SymmetricDirichlet[src]

type Posterior = Dirichlet

impl ContinuousDistr<Vec<f64>> for SymmetricDirichlet[src]

impl Debug for SymmetricDirichlet[src]

impl Display for SymmetricDirichlet[src]

impl<'_> From<&'_ SymmetricDirichlet> for String[src]

impl<'_> From<&'_ SymmetricDirichlet> for Dirichlet[src]

impl From<SymmetricDirichlet> for Dirichlet[src]

impl PartialEq<SymmetricDirichlet> for SymmetricDirichlet[src]

impl PartialOrd<SymmetricDirichlet> for SymmetricDirichlet[src]

impl Rv<Categorical> for SymmetricDirichlet[src]

impl Rv<Vec<f64>> for SymmetricDirichlet[src]

impl StructuralPartialEq for SymmetricDirichlet[src]

impl Support<Vec<f64>> for SymmetricDirichlet[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Fx, X> ContinuousDistr<X> for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: ContinuousDistr<X>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<Fx, X> Rv<X> for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Rv<X>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

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

impl<Fx, X> Support<X> for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Support<X>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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