Skip to content

fix: keep highest-coverage threshold in single-set gate - #78

Open
ben564885 wants to merge 1 commit into
adrida:mainfrom
ben564885:fix/calibrate-threshold-max-coverage
Open

ben564885 wants to merge 1 commit into
adrida:mainfrom
ben564885:fix/calibrate-threshold-max-coverage

Conversation

@ben564885

@ben564885 ben564885 commented Jul 31, 2026 •

Copy link
Copy Markdown

fixes #77.

the single-set fallback branch of _calibrate_threshold overwrote best on every threshold that cleared the clopper-pearson bound, so it kept the highest one. coverage is monotonically non-increasing in t, so that is always the lowest-coverage candidate — the opposite of what the inline comment claimed.

break on the first match instead. every candidate in the loop already passes the same gate at the same alpha, so this recovers coverage without touching the guarantee.

before / after on the repro in #77: coverage 30.6% -> 91.7%.

across 15 fit configs the deployed policy changed in 9 (e.g. 31.4% -> 91.4%), with measured live teacher agreement staying at or above target in every case.

two regression tests added. both fail on main with the exact numbers above and pass here. full suite: 129 passed, 3 skipped.

@ben564885
ben564885 requested a review from adrida as a code owner July 31, 2026 07:37
the fallback branch overwrote `best` on every qualifying threshold, so it
kept the highest one. coverage is non-increasing in t, so that is always
the lowest-coverage candidate. break on the first match instead.

fixes adrida#77
@ben564885
ben564885 force-pushed the fix/calibrate-threshold-max-coverage branch from 58f73b7 to 97b83d2 Compare July 31, 2026 07:48
Repository owner deleted a comment from tarun101 Aug 17, 2026

This branch has not been deployed

No deployments
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.

_calibrate_threshold picks minimum coverage on small calibration sets

1 participant