CountSketch and Signed Updates

Use random signs to cancel expected collision error and combine independent row estimates robustly.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Multiply by the query key’s sign
  2. The median reduces the impact of an unlucky row

Multiply by the query key’s sign

In each row, hash key \(j\) to a bucket and update it by its frequency change times a random sign \(s_j\). Estimate \(f_x\) by multiplying its bucket by \(s_x\). The query’s own contribution becomes \(s_x^2f_x=f_x\). The other terms have expected zero under independent unbiased signs, even for signed updates. Conditioned on the bucket hash, cross terms vanish in the variance computation. With collision probability \(1/w\), mean-squared error is at most \(\sum_{j\ne x} f_j^2/w\).

The median reduces the impact of an unlucky row

A large collision can still skew one estimate in either direction. Chebyshev’s inequality controls a single row’s deviation using its variance. Taking the median of independent rows amplifies that constant-probability guarantee. Compatible sketches can be added by adding their arrays, since updates are linear. This differs from the Count-Min sketch, whose minimum uses nonnegative collision contributions and an error scaled by total mass.[1]

References

  1. Moses Charikar, Kevin Chen and Martin Farach-Colton, Finding Frequent Items in Data Streams ↩