Trait rv::traits::SuffStat[][src]

pub trait SuffStat<X> {
    fn observe(&mut self, x: &X);
fn forget(&mut self, x: &X); fn observe_many(&mut self, xs: &Vec<X>) { ... }
fn forget_many(&mut self, xs: &Vec<X>) { ... } }

Is a sufficient statistic for a distribution.

Example

use rv::data::BernoulliSuffStat;
use rv::traits::SuffStat;

// Bernoulli sufficient statistics are the number of observations, n, and
// the number of successes, k.
let mut stat = BernoulliSuffStat::new();

assert!(stat.n == 0 && stat.k == 0);

stat.observe(&true);  // observe `true`
assert!(stat.n == 1 && stat.k == 1);

stat.observe(&false);  // observe `false`
assert!(stat.n == 2 && stat.k == 1);

stat.forget_many(&vec![false, true]);  // forget `true` and `false`
assert!(stat.n == 0 && stat.k == 0);

Required Methods

Assimilate the datum x into the statistic

Remove the datum x from the statistic

Provided Methods

Assimilate several observations

Forget several observations

Implementors