FA-72992 / Probabilistic sketches / Member archive
HyperLogLog cardinality estimate: harmonic sum skips empty registers · case 02
Raw estimates explode for sparse sketches because empty registers no longer contribute 1 each.
Case contract
Input {regs} with 16, 32, 64 or 128 registers. alpha is 0.673, 0.697, 0.709 for m = 16, 32, 64 and 0.7213/(1 + 1.079/m) otherwise. Raw E = alpha m^2 / sum 2^-r. If E <= 2.5m and V (zero registers) > 0, use linear counting m ln(m/V); otherwise if E > 2^32/30 apply the large-range correction -2^32 ln(1 - E/2^32). Return [round(E), V].
Why this case matters
Distinct-count dashboards and query planners rely on the bias corrections of the HyperLogLog estimator at both small and large cardinalities.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| sparse m=16 | [81, 10] | [8, 10] | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗