Struct rv::data::CategoricalSuffStat[][src]

pub struct CategoricalSuffStat { /* fields omitted */ }

Categorical distribution sufficient statistic.

Store the number of observations and the count of observations of each instance.

Implementations

impl CategoricalSuffStat[src]

pub fn new(k: usize) -> Self[src]

pub fn from_parts_unchecked(n: usize, counts: Vec<f64>) -> Self[src]

Create a sufficient statistic from components without checking whether they are valid.

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

Get the total number of trials

Example

let mut stat = CategoricalSuffStat::new(3);

stat.observe(&0_u8);
stat.observe(&1_u8);
stat.observe(&1_u8);

assert_eq!(stat.n(), 3);

pub fn counts(&self) -> &Vec<f64>[src]

Get the number of occurrences of each class, counts

Example

let mut stat = CategoricalSuffStat::new(3);

stat.observe(&0_u8);
stat.observe(&1_u8);
stat.observe(&1_u8);

assert_eq!(*stat.counts(), vec![1.0, 2.0, 0.0]);

Trait Implementations

impl Clone for CategoricalSuffStat[src]

impl Debug for CategoricalSuffStat[src]

impl<'a, X> From<&'a CategoricalSuffStat> for DataOrSuffStat<'a, X, Categorical> where
    X: CategoricalDatum
[src]

impl PartialEq<CategoricalSuffStat> for CategoricalSuffStat[src]

impl StructuralPartialEq for CategoricalSuffStat[src]

impl<X: CategoricalDatum> SuffStat<X> for CategoricalSuffStat[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<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[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<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.

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