pub struct Dirichlet { /* private fields */ }Expand description
Dirichlet distribution, conjugate prior for multinomial likelihood.
After observing counts c₁, ..., cₖ, the posterior is
Dirichlet(α₁ + c₁, ..., αₖ + cₖ).
Implementations§
Source§impl Dirichlet
impl Dirichlet
Sourcepub fn new(alpha: Vec<f64>) -> Result<Self>
pub fn new(alpha: Vec<f64>) -> Result<Self>
Create a Dirichlet distribution with concentration parameters alpha.
All elements must be positive and the vector must have at least 2 elements.
Sourcepub fn symmetric(k: usize, alpha: f64) -> Result<Self>
pub fn symmetric(k: usize, alpha: f64) -> Result<Self>
Create a symmetric Dirichlet with k categories, each with
concentration alpha.
Sourcepub fn update_multinomial(&self, counts: &[u64]) -> Self
pub fn update_multinomial(&self, counts: &[u64]) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Dirichlet
impl RefUnwindSafe for Dirichlet
impl Send for Dirichlet
impl Sync for Dirichlet
impl Unpin for Dirichlet
impl UnsafeUnpin for Dirichlet
impl UnwindSafe for Dirichlet
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