[][src]Struct stats::Frequencies

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

A commutative data structure for exact frequency counts.

Methods

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

pub fn new() -> Frequencies<T>[src]

Create a new frequency table with no samples.

pub fn add(&mut self, v: T)[src]

Add a sample to the frequency table.

pub fn count(&self, v: &T) -> u64[src]

Return the number of occurrences of v in the data.

pub fn cardinality(&self) -> u64[src]

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

pub fn mode(&self) -> Option<&T>[src]

Returns the mode if one exists.

pub fn most_frequent(&self) -> Vec<(&T, u64)>[src]

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

pub fn least_frequent(&self) -> Vec<(&T, u64)>[src]

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

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

Returns the cardinality of the data.

Trait Implementations

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

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

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

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

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

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

Auto Trait Implementations

impl<T> RefUnwindSafe for Frequencies<T> where
    T: RefUnwindSafe

impl<T> Send for Frequencies<T> where
    T: Send

impl<T> Sync for Frequencies<T> where
    T: Sync

impl<T> Unpin for Frequencies<T> where
    T: Unpin

impl<T> UnwindSafe for Frequencies<T> where
    T: UnwindSafe

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.