Struct stats::Frequencies [−][src]
pub struct Frequencies<T> { /* fields omitted */ }
A commutative data structure for exact frequency counts.
Methods
impl<T: Eq + Hash> Frequencies<T>
[src]
impl<T: Eq + Hash> Frequencies<T>
pub fn new() -> Frequencies<T>
[src]
pub fn new() -> Frequencies<T>
Create a new frequency table with no samples.
pub fn add(&mut self, v: T)
[src]
pub fn add(&mut self, v: T)
Add a sample to the frequency table.
pub fn count(&self, v: &T) -> u64
[src]
pub fn count(&self, v: &T) -> u64
Return the number of occurrences of v
in the data.
pub fn cardinality(&self) -> u64
[src]
pub fn cardinality(&self) -> u64
Return the cardinality (number of unique elements) in the data.
pub fn mode(&self) -> Option<&T>
[src]
pub fn mode(&self) -> Option<&T>
Returns the mode if one exists.
pub fn most_frequent(&self) -> Vec<(&T, u64)>
[src]
pub fn most_frequent(&self) -> Vec<(&T, u64)>
Return a Vec
of elements and their corresponding counts in
descending order.
pub fn least_frequent(&self) -> Vec<(&T, u64)>
[src]
pub fn least_frequent(&self) -> Vec<(&T, u64)>
Return a Vec
of elements and their corresponding counts in
ascending order.
pub fn len(&self) -> usize
[src]
pub fn len(&self) -> usize
Returns the cardinality of the data.
Trait Implementations
impl<T: Clone> Clone for Frequencies<T>
[src]
impl<T: Clone> Clone for Frequencies<T>
fn clone(&self) -> 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[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T: Debug + Eq + Hash> Debug for Frequencies<T>
[src]
impl<T: Debug + Eq + Hash> Debug for Frequencies<T>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T: Eq + Hash> Commute for Frequencies<T>
[src]
impl<T: Eq + Hash> Commute for Frequencies<T>
fn merge(&mut self, v: 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)
[src]
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]
impl<T: Eq + Hash> Default for Frequencies<T>
fn default() -> 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]
impl<T: Eq + Hash> FromIterator<T> for Frequencies<T>
fn from_iter<I: IntoIterator<Item = T>>(it: I) -> 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]
impl<T: Eq + Hash> Extend<T> for Frequencies<T>
fn extend<I: IntoIterator<Item = T>>(&mut self, it: I)
[src]
fn extend<I: IntoIterator<Item = T>>(&mut self, it: I)
Extends a collection with the contents of an iterator. Read more
Auto Trait Implementations
impl<T> Send for Frequencies<T> where
T: Send,
impl<T> Send for Frequencies<T> where
T: Send,
impl<T> Sync for Frequencies<T> where
T: Sync,
impl<T> Sync for Frequencies<T> where
T: Sync,