Skip to content

feat(weighted_frequency): public point estimate and heap-less capacity 0 - #225

Closed
zzylol wants to merge 1 commit into
feat/weighted-frequency-kernelfrom
feat/weighted-frequency-point-estimate
Closed

zzylol wants to merge 1 commit into
feat/weighted-frequency-kernelfrom
feat/weighted-frequency-point-estimate

Conversation

@zzylol

@zzylol zzylol commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

Why

ASAPPlanner's executor moves its plain CountSketch onto the per-row-seeded WeightedFrequency kernel, so that each row hashes independently and the planner's binomial-tail failure probability holds at any depth. That kernel has no public point estimate and no heap-less mode yet.

What

  • A public point-estimate method on WeightedFrequency.
  • Capacity 0 now means "no heap" (a plain sketch with no top-k).

How

A small API addition on top of the weighted frequency kernels (#160). This PR is stacked on #160's branch.

Before this PR

Callers could read estimates only through the heap path, and a heap was always allocated.

After this PR

A caller can build a heap-less sketch and query any key's estimate.

Verification

See the commit's tests. ASAPPlanner's planner pin branch planner-pin/univmon-certifiable-weighted-frequency-estimate (9415c5b) uses this commit, and its executor tests pass there (ASAPPlanner PR #706).

Limitations

Stacked on #160; retarget to main after #160 merges.

`WeightedFrequency::estimate` reads one identity tuple's point estimate
(min over rows for CMS, sign-corrected median for CountSketch), with the
same identity normalization as `update`. Capacity 0 builds a frequency
sketch that retains no candidates, so a plain CountSketch or Count-Min can
use the kernel's per-row seeding without carrying a heap.
@zzylol

zzylol commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

Closing: main now provides f64 Count-Min and Count Sketch with heaps (#232), ASAPv1 serialization as the only format (#241) and TupleKey group-by keys (#237), so WeightedFrequency's own kernel and ASAP-WFREQ-1 format are redundant. The remaining gaps (shape and weight checks, an atomic checked f64 update, a full clear, opt-in rescoring of retained candidates, and estimated_memory_bytes) move to new PRs on main's heap sketches. The old head is kept on backup/feat/weighted-frequency-point-estimate-20261020-161432.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant