Local Map and Reduce with Counts

A map can transform observations into intermediate contributions and a reduction can combine those contributions under a stated grouping rule.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Trace four readings
  2. Choose an associative combine rule

Trace four readings

Map labels A, B, A, C to contributions (A,1), (B,1), (A,1), and (C,1). Group by label and sum to obtain A=2, B=1, C=1. Frequency maps store the one-pass version of these results.

Choose an associative combine rule

Sums can combine subgroup totals in different groupings when arithmetic is exact. A bare arithmetic mean of subgroup averages can be wrong when group sizes differ. See running averages.[1]

References

  1. Python Software Foundation, Functional Programming HOWTO ↩