Count-Min Sketch and One-Sided Frequency Error
Derive the additive error of a Count-Min sketch and see why row independence amplifies the guarantee.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Each collision contributes nonnegative mass
Use \(d\) separately hashed rows with \(w\) counters each. For every positive update to key \(x\), add its weight to its bucket in each row. To query \(x\), return the minimum of its \(d\) buckets. In each row the count equals \(f_x\) plus collision mass. With pairwise collision probability at most \(1/w\), expected collision mass is at most \(\|f\|_1/w\) by linearity of expectation.
Several independent rows are unlikely to all overestimate badly
For \(w\ge e/\varepsilon\), Markov’s inequality bounds the chance a row exceeds \(f_x+\varepsilon\|f\|_1\) by \(1/e\). Independent row hashes make the probability all fail at most \(e^{-d}\), for a fixed query key. Taking the minimum preserves the upper estimate for nonnegative frequencies. Signed frequencies can require a different sketch. The CountSketch uses random signs and a variance analysis for that setting.[1]