Struct stats::Frequencies [] [src]

pub struct Frequencies<T> {
    // some fields omitted
}

A commutative data structure for exact frequency counts.

Methods

impl<T: Eq + Hash> Frequencies<T>
[src]

fn new() -> Frequencies<T>

Create a new frequency table with no samples.

fn add(&mut self, v: T)

Add a sample to the frequency table.

fn count(&self, v: &T) -> u64

Return the number of occurrences of v in the data.

fn cardinality(&self) -> u64

Return the cardinality (number of unique elements) in the data.

fn mode(&self) -> Option<&T>

Returns the mode if one exists.

fn most_frequent(&self) -> Vec<(&T, u64)>

Return a Vec of elements and their corresponding counts in descending order.

fn least_frequent(&self) -> Vec<(&T, u64)>

Return a Vec of elements and their corresponding counts in ascending order.

fn len(&self) -> usize

Returns the cardinality of the data.

Trait Implementations

impl<T: Clone> Clone for Frequencies<T>
[src]

fn clone(&self) -> Frequencies<T>

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl<T: Debug + Eq + Hash> Debug for Frequencies<T>
[src]

fn fmt(&self, f: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<T: Eq + Hash> Commute for Frequencies<T>
[src]

fn merge(&mut self, v: Frequencies<T>)

Merges the value other into self.

fn consume<I: Iterator<Item=Self>>(&mut self, other: I)

Merges the values in the iterator into self.

impl<T: Eq + Hash> Default for Frequencies<T>
[src]

fn default() -> Frequencies<T>

Returns the "default value" for a type. Read more

impl<T: Eq + Hash> FromIterator<T> for Frequencies<T>
[src]

fn from_iter<I: IntoIterator<Item=T>>(it: I) -> Frequencies<T>

Creates a value from an iterator. Read more

impl<T: Eq + Hash> Extend<T> for Frequencies<T>
[src]

fn extend<I: IntoIterator<Item=T>>(&mut self, it: I)

Extends a collection with the contents of an iterator. Read more