PLAIN/TEXT — ISSUE 425/456 COMPUTER SCIENCE · FOUNDATION / COMPUTER SCIENCE · ~4 MIN READING DATE: 2027-11-30 ARCHIVE: https://plaintext.click/newsletter/ SUBJECT: A tiny table can estimate a very large tally A tiny table can estimate a very large tally ============================================ / START HERE A website may need rough visit totals for millions of different pages without storing a separate counter for each one. A count-min sketch is a compact table of shared counters used to estimate how often each item appears. Items can share counters, so the design accepts some overcounting in exchange for much smaller storage. / WHY NOW Unlike a counter for the total number of arrivals, this structure answers a separate question for each named item. Its useful trick is to make unrelated items collide differently in several rows. / THE IDEA A hash function maps an item’s name to a column number. Each row uses its own hash function. When an item arrives, add one to its selected counter in every row. The table has a fixed number of rows and columns regardless of how many distinct names appear. To estimate an item’s frequency, look at its selected counters and take the smallest. Every selected counter contains all of that item’s arrivals plus arrivals from other names sharing that location. With non-negative updates, none can be smaller than the true count. The minimum tries to choose the least contaminated view. / THE FORMAL IDEA f̂(x) = min_j table[j, h_j(x)] - f̂(x) = estimated count for item x; j = row number; h_j(x) = the column selected for x in that row. - min means choose the smallest listed counter. Counts are numbers of arrivals, not bytes or seconds; the basic example permits additions only. / RUN THE TINY EXAMPLE Change one thing. Predict what happens. Tea appears 4 times, coffee 2 times and cocoa 3 times. In row 1, tea shares with coffee: selected counter = 4 + 2 = 6. In row 2, tea shares with cocoa: selected counter = 4 + 3 = 7. Estimate = min(6,7) = 6. Change coffee arrivals to 0: the selected counters become 4 and 7, so tea’s estimate becomes exactly 4. Tea’s own frequency stayed fixed; unrelated traffic changed its overcount. Several independently chosen rows reduce the chance that every view is badly contaminated. Wider rows reduce sharing, while more rows provide more chances to find a relatively clean counter. Those are different ways to spend additional memory. / SO WHAT? A sketch is useful for approximate popularity or traffic monitoring when retaining every name-and-count pair is too expensive. It does not identify all item names by itself, and an estimated count should not silently become an exact billing record. Applications need an error budget tied to total traffic and the sketch dimensions. / ONE CAVEAT Guarantees require suitable independent hash choices and the stated update model. Arbitrary negative updates, adversarially selected collisions or overflow can break the simple no-undercount argument; a fixed table has not made collisions disappear. / KEEP THIS For insertion-only traffic, shared counters inflate counts; querying the minimum across independent rows limits contamination without storing an exact counter for every item. / SOURCE TRAIL [1] Cormode and Muthukrishnan — Count-min sketch technical report https://archive.dimacs.rutgers.edu/TechnicalReports/abstracts/2003/2003-20.html [2] UMass — Data streams and count-min sketches https://people.cs.umass.edu/~mcgregor/slides/epit-1.pdf NEXT: The units can catch a wrong answer before you calculate --- HARD IDEAS. PLAIN TEXT. You are receiving this because you asked for one clear computer-science or physics idea each day. Unsubscribe: https://plaintext.click/unsubscribe View in browser: https://plaintext.click/newsletter/2027/11/2027-11-30-count-min-frequency-sketch.html From: Plain/Text / Brickston Consulting · 30 N Gould St Ste N, Sheridan, WY 82801 US · knowledge@plaintext.click