Function stats::antimodes

source ·
pub fn antimodes<T, I>(it: I) -> (Vec<T>, usize, u32)where
    T: PartialOrd + Clone,
    I: Iterator<Item = T>,
Expand description

Compute the antimodes on a stream of data.

Antimode is the least frequent non-zero score.

If there is a single antimode, then only that value is returned in the Vec however, if there are multiple values tied for occurring the least amount of times those values are returned.

Only the first 10 antimodes are returned to prevent returning the whole set when cardinality = number of records (i.e. all unique values).

Example

use stats;

let vals = vec![1, 1, 2, 2, 3];

assert_eq!(stats::antimodes(vals.into_iter()), (vec![3], 1, 1));

This has time complexity O(n)

If the data does not have an antimode, then an empty Vec is returned.