Abstract Algebra for Scala.

This code is targeted at building aggregation systems (via Scalding, Apache Storm or Summingbird). It was originally developed as part of Scalding’s Matrix API, where Matrices had values which are elements of Monoids, Groups, or Rings. Subsequently, it was clear that the code had broader application within Scalding and on other projects within Twitter.

In the above, the class Max[T] signifies that the + operator should actually be max (this is accomplished by providing an implicit instance of a typeclass for Max that handles +).

Model a wide class of “reductions” as a sum on some iterator of a particular value type. For example, average, moving average, max/min, set union, approximate set size (in much less memory with HyperLogLog), approximate item counting (using CountMinSketch).

All of these combine naturally in tuples, vectors, maps, options and more standard scala classes.

Implementations of Monoids for interesting approximation algorithms, such as Bloom filter, HyperLogLog and CountMinSketch. These allow you to think of these sophisticated operations like you might numbers, and add them up in hadoop or online to produce powerful statistics and analytics.

Using Algebird

Algebird modules are available on Maven Central. The current groupid and version for all modules is, respectively, "com.twitter" and 0.12.3.

See Algebird’s page on the Scaladex for information on all published artifacts and their associated Scala versions. Algebird currently supports Scala 2.10 and 2.11.