feat(calibration): pure confusion-matrix scorer for candidate rule classifiers - #8098
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
1 similar comment
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8098 +/- ##
==========================================
- Coverage 92.01% 92.00% -0.01%
==========================================
Files 755 756 +1
Lines 77201 77218 +17
Branches 23337 23344 +7
==========================================
+ Hits 71034 71047 +13
Misses 5061 5061
- Partials 1106 1110 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-22 22:39:24 UTC
Review summary Nits — 2 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Summary
packages/loopover-engine/src/calibration/backtest-score.tswithBacktestScoreReportandscoreBacktest(ruleId, cases, classify): replays a caller-supplied synchronous classifier over a labeledBacktestCase[]corpus (calibration: pure BacktestCase corpus builder from RuleFiredEvent/HumanOverrideEvent pairs #8083) and scores it against the real human verdicts — the "would the proposed rule have gotten more of these right?" primitive, mirroringsrc/review/auto-tune.ts'sGateEvalRowconfusion-matrix shape at a backtest-replay grain."reversed"is the positive class — correctly predicting that a firing was wrong is the true positive.precision/recallarenullwhen their denominator is 0, never coerced to 0 or 1 — the same "unknown stays unknown" discipline asRulePrecisionReport.precisioninsignal-tracking.ts; cases for a differentruleIdare excluded from every count,caseCountincluded, mirroringcomputeRulePrecision's defensive override filter.packages/loopover-engine/src/index.tson its own line immediately after thebacktest-corpus.jsline, per the issue's deliverable.Closes #8085
Test plan
packages/loopover-engine/test/backtest-score.test.ts(node:test, per the issue's deliverable): all-correct classifier → precision 1 / recall 1; all-wrong classifier → precision 0 / recall 0 with the misses in the right cells; mixed classifier accumulating all four cells; empty corpus → zero counts with both ratiosnull; separate explicit null-precision (classifier never predicts reversed) and null-recall (no reversed labels) cases; non-matchingruleIdexcluded from every count includingcaseCounttest/unit/backtest-score-engine.test.ts(vitest, importing the engine source): same cases — this is what exercises the.tsforcodecov/patch, since@loopover/engineimports resolve todist(the trap that has already failed prior PRs in this issue family)npm run test --workspace @loopover/enginegreen;npm run typecheckgreen