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

pub struct CategoricalSuffStat { /* fields omitted */ }

Categorical distribution sufficient statistic.

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

Methods

impl CategoricalSuffStat[src]

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

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

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

impl Clone for CategoricalSuffStat[src]

impl PartialEq<CategoricalSuffStat> for CategoricalSuffStat[src]

impl PartialOrd<CategoricalSuffStat> for CategoricalSuffStat[src]

impl Debug for CategoricalSuffStat[src]

impl StructuralPartialEq for CategoricalSuffStat[src]

Auto Trait Implementations

Blanket Implementations

impl<S, X> SuffStat<X> for S where
    S: DerefMut,
    <S as Deref>::Target: SuffStat<X>, 
[src]

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

impl<T> From<T> for 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.

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

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

impl<T> Any for T where
    T: 'static + ?Sized
[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<V, T> VZip<V> for T where
    V: MultiLane<T>,