Count-Min as a probabilistic program #
sampleSketch independently repeats a caller-supplied seed sampler and processes a weighted
insertion stream with the resulting hash rows. Its output retains both the row seeds and the
materialized counter table, so later queries use the same hashes. sampleQuery constructs a
sketch and returns one point query. The hash family is supplied separately and must remain fixed
between construction and queries.
When one seed is exactly uniform, repeated calls give the uniform distribution on row-seed
tuples. This identifies the output law of the program with the deterministic construction
analyzed in CountMin.Probability, giving its fixed-query failure bound. The stream and query
are fixed before the seeds are sampled. No running-time or representation cost is asserted for
the supplied sampler, hash function, or program.
Main definitions #
Cslib.CountMin.Sketch: row seeds together with the stored counter table.Cslib.CountMin.buildSketch,Cslib.CountMin.Sketch.query: deterministic construction and point queries retaining the construction's hashes.Cslib.CountMin.sampleSketch,Cslib.CountMin.sampleQuery: probabilistic construction and a fixed point query.
Main results #
Cslib.CountMin.eval_sampleSketch,Cslib.CountMin.eval_sampleQuery: output laws under a uniform seed sampler.Cslib.CountMin.frequency_le_of_mem_support_sampleQuery: every possible query result avoids underestimation, without any uniformity assumption.Cslib.CountMin.sampleQuery_error_le_inv_two_pow: failure probability at most2⁻ᵈwhen2 ≤ w * ε, for a two-universal hash family and a uniform seed sampler.
References #
A uniform seed sampler gives the deterministic construction a uniform row-seed tuple.
The point-query program has the law of querying a uniformly sampled hash bank.
Every possible output of the point-query program is at least the true frequency.
The actual point-query program has failure probability at most 2⁻ᵈ with at least
2 / ε buckets and independently uniform seeds for a two-universal hash family.