Fix longest_run undercounting the final run#14
Open
nh13 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LowerBoundCorrection::newonly commits a run tomax_run_lengthon a transition, so the final run is never recorded.longest_runthen undercounts, and returns 0 for any leaf whose entries form a single run. This feeds the per-leaf error bound intwo_layer.rs, so the undercount propagates into the reported model error. Flushing the in-progress run after the loop fixes it, with a regression test for the single-run case.Small heads-up: I wasn't able to run this through
cargo test— a couple of the#[cfg(test)]modules don't currently compile against the latest API (ModelDatalooks like it was renamed), and since CI runs thetests/integration harness rather thancargo test, it hadn't surfaced. I verified this fix against the real code separately. I'll send a small follow-up PR to get the unit tests compiling again.(Also noticed
data.get_key(0)panics on empty input — happy to fold that into the follow-up.)Made in collaboration with Claude.