One row of a Count-Sketch #
A row of the Count-Sketch of Charikar, Chen and Farach-Colton [CCFC04]
has w buckets. Its seed (θ, φ) consists of a seed θ of a bucket hash h θ : X → Fin w and
an independent seed φ of a sign hash ε (g φ x) = ±1. For weights f : X → ℝ on a finite set
S, the bucket j holds ∑ x ∈ S with h θ x = j, f x ε (g φ x), and the estimate of f a is the
bucket of a times the sign of a. Collisions of a with the other points add the noise
∑ x ∈ S with h θ x = h θ a, f x ε (g φ x), summed over x ≠ a.
For a two-universal bucket family and a pairwise independent family of signs of mean zero:
- the estimate is unbiased (
Cslib.Probability.CountSketch.expect_sum_ite_mul_sign_mul_sign); - the noise has second moment at most
∑_{x ≠ a} f x ² / w(Cslib.Probability.CountSketch.expect_sq_sum_ite_mul_sign_le), so by Chebyshev's inequality the noise exceedstfor at most a third of the seeds once3 ∑_{x ≠ a} f x ² ≤ w t²(Cslib.Probability.CountSketch.dens_abs_sum_ite_mul_sign_gt_le).
These are equations (5.1)–(5.6) of [Chakrabarti2025, Section 5.3.1], for arbitrary real weights, so they apply to turnstile streams as well as to insertion streams. Only an upper bound on collision probabilities is assumed of the bucket family.
Main results #
Cslib.Probability.CountSketch.expect_sum_ite_mul_sign_mul_sign: the estimate is unbiased.Cslib.Probability.CountSketch.expect_sq_sum_ite_mul_sign_le: the second moment of the noise.Cslib.Probability.CountSketch.dens_abs_sum_ite_mul_sign_gt_le: the tail bound of one row.
References #
The Count-Sketch estimate is unbiased [Chakrabarti2025, equations (5.1)–(5.2)]: for any
bucket hash h, an independent pairwise independent sign family ε ∘ g of mean zero, and a ∈ S,
the bucket of a times the sign of a has mean f a. Only the pairwise independence of the signs
is used.
The second moment of the Count-Sketch noise [Chakrabarti2025, equations (5.3)–(5.5)]: with
a two-universal bucket family h and an independent pairwise independent sign family ε ∘ g of
mean zero, the noise added to the bucket of a ∉ S by the points of S has second moment at most
∑ x ∈ S, f x ² / w.
One row of a Count-Sketch [Chakrabarti2025, equation (5.6)]: with a two-universal bucket
family h and an independent pairwise independent sign family ε ∘ g of mean zero, the noise added
to the bucket of a ∉ S by the points of S exceeds t ≥ 0 in absolute value for at most a third
of the seeds once 3 ∑ x ∈ S, f x ² ≤ w t².