Struct probability::prelude::Categorical[][src]

pub struct Categorical { /* fields omitted */ }

A categorical distribution.

Implementations

impl Categorical[src]

pub fn new(p: &[f64]) -> Self[src]

Create a categorical distribution with success probability p.

It should hold that p[i] >= 0, p[i] <= 1, and sum(p) == 1.

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

Return the number of categories.

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

Return the event probabilities.

Trait Implementations

impl Clone for Categorical[src]

impl Debug for Categorical[src]

impl Discrete for Categorical[src]

impl Distribution for Categorical[src]

type Value = usize

The type of outcomes.

impl Entropy for Categorical[src]

impl Inverse for Categorical[src]

impl Kurtosis for Categorical[src]

impl Mean for Categorical[src]

impl Median for Categorical[src]

impl Modes for Categorical[src]

impl Sample for Categorical[src]

impl Skewness for Categorical[src]

impl Variance for Categorical[src]

Auto Trait Implementations

impl RefUnwindSafe for Categorical

impl Send for Categorical

impl Sync for Categorical

impl Unpin for Categorical

impl UnwindSafe for Categorical

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<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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.