Short answer: MinHash estimates the Jaccard similarity of two sets. With a random hash, the probability that the element of minimum hash is the same in both sets equals the Jaccard index, the size of the intersection divided by the size of the union. k independent hashes give k…
Category: Sketches
How HyperLogLog estimates a cardinality
Short answer: HyperLogLog estimates the number of distinct items in a stream from the position of the first 1-bit in each item’s hash. Items are bucketed by the first p bits of the hash, into m = 2^p registers. Each register stores the maximum number of leading zeros, plus…
How a count-min sketch estimates a frequency
Short answer: A count-min sketch estimates the frequency of items in a stream with a table of d rows and w counters. Each row has its own hash into the w columns. An update of item x by c adds c to one counter in every row. The estimate…
How a Bloom filter records membership in bits
Short answer: A Bloom filter stores a set in a bit array of m bits using k independent hash functions. Insert sets the k bits of an item to 1. A query returns present only if all k bits are 1. A present item is always reported present. An…
