pub fn make_count_by<MO, TK, TV>(
    input_domain: VectorDomain<AtomDomain<TK>>,
    input_metric: SymmetricDistance
) -> Fallible<Transformation<VectorDomain<AtomDomain<TK>>, MapDomain<AtomDomain<TK>, AtomDomain<TV>>, SymmetricDistance, MO>>where
    MO: CountByConstant<MO::Distance> + Metric,
    MO::Distance: Number,
    TK: Hashable,
    TV: Number,
    (VectorDomain<AtomDomain<TK>>, SymmetricDistance): MetricSpace,
    (MapDomain<AtomDomain<TK>, AtomDomain<TV>>, MO): MetricSpace,
Expand description

Make a Transformation that computes the count of each unique value in data. This assumes that the category set is unknown.

Citations

Generics

  • MO - Output Metric.
  • TK - Type of Key. Categorical/hashable input data type. Input data must be Vec<TK>.
  • TV - Type of Value. Express counts in terms of this integral type.

Returns

The carrier type is HashMap<TK, TV>, a hashmap of the count (TV) for each unique data input (TK).