Repository navigation
fix(repo): tiny per-task values, arm means, delta_std and the mde note keep 2 significant digits, not 0.0 - #1259
Merged
Conversation
… and arm means below 5e-7 (intel#1224) compare._round kept 6 places, so every per-task baseline, treatment and delta and the arm means baseline_mean and treatment_mean below 5e-7 printed as 0.0 beside a non-zero delta, interval and p. _round now goes through round_off_zero(value, 6): a value that 6 places would put at 0 keeps 2 significant digits and its sign, a zero stays 0.0, and a non-finite value is still None. Values of 5e-7 and above print as before. mde, the one field that used the separate _round_off_zero wrapper, now uses _round, and the wrapper is removed. The "changed:" line of format_compare read the rounded task deltas to leave out noise, so a delta of 4e-7 would now have been listed as +0.00. It tests round(delta, 6) instead, which lists the same tasks as before. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…el#1225) _describe_deltas printed delta_std as round(d_sd, 2), so a spread under 0.005 was 0.0 beside a non-zero delta_mean, cohens_d and interval. delta_std now goes through round_off_zero(d_sd, 2), the helper round_mean is built on: a spread that 2 places would put at 0 keeps 2 significant digits, an exact 0 stays 0.0, and a spread of 0.005 and above prints as before. A non-finite spread is still refused before this line. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
… scientific notation (intel#1226) _inconclusive_note formatted mde as :.3f below 1e6, so a row whose mde field is 2.6e-12 read "about ±0.000" in the note. A non-zero mde below 0.0005 now prints as :.1e (2 significant digits, the precision the field carries): "about ±2.6e-12". fmt_small was tried and gives a 13-decimal string for this value, unreadable in a sentence. An mde of 0.0005 and above keeps :.3f, and 1e6 and above :.3e. The text is pinned in test_repo_compare_reading.py. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 8 selected item(s). CI at Test notes (2)
Review details
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1259 +/- ##
==========================================
- Coverage 96.14% 96.13% -0.02%
==========================================
Files 498 498
Lines 66004 66005 +1
Branches 11461 11462 +1
==========================================
- Hits 63460 63454 -6
- Misses 1573 1576 +3
- Partials 971 975 +4
🚀 New features to boost your workflow:
|
napetrov
approved these changes
Nov 26, 2026
napetrov
left a comment
Contributor
There was a problem hiding this comment.
Change class: CONTRACT (head 75b3598)
- Contract: changed (count signal only, no file:line)
- Responsibility: none
- Dependency: none
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
Checked the output rounding for per-task values, arm means, standard deviation and the minimum detectable effect. The sign-flip calculation still consumes the full-precision inputs. The statistics and repo comparison suites passed locally (425 tests), and CI is green.
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.
Summary
Three leftovers of #817 (fixed by #1227), where a tiny value prints as
0.0. #1227 gave the interval ends,delta.meanandmde2 significant digits throughround_off_zero; these sites were left. Onmain:mainrepo compare, eight pairs with baseline1e-12and deltas1e-12to6e-12(sign_flip_summary)tasks[0]is{'task': 't0', 'baseline': 0.0, 'treatment': 0.0, 'delta': 0.0},baseline_meanandtreatment_meanare0.0, besidedelta.mean3.4e-12 and p 0.007812stats.paired_test([2e-12, 4e-12, 3e-12, 5e-12, 6e-12, 9e-12, 7e-12, 8e-12], [1e-12] * 8)delta_std0.0 (the sd is about 2.4e-12), besidedelta_mean4.5e-12 andcohens_d1.8371e-12and deltas[3e-12, -2e-12, 1e-12, -1e-12, 2e-12, -3e-12, 1.5e-12, -2.5e-12],mde2.6e-12at about ±0.000 (8 tasks)Options taken. #1224:
_roundgoes throughround_off_zero(value, 6), the way #1227 fixedmde, so one rounding serves every field of the row (mdeused a second wrapper,_round_off_zero, which is now removed). #1225:round_off_zero(d_sd, 2), the helperround_meanis built on. #1226: of the two options (scientific notation orfmt_small), scientific notation:fmt_small(2.6e-12)is+0.0000000000026, a 13-decimal string that is unreadable in the middle of a sentence, and it is signed where the note prints±. A non-zeromdebelow 0.0005 prints as.1e(2.6e-12: 2 significant digits, the precision the field carries); 0.0005 and above keeps.3f, and 1e6 and above.3e.The same cause in the text tables of
repo compareand the rule ledger (a tiny mean prints as0.000) is tracked in #1258.Closes #1224
Closes #1225
Closes #1226
Changes
dokimi/dokimi/repos/compare.py:_roundkeeps 2 significant digits where 6 places give 0 (a zero stays0.0, never-0.0; a negative keeps its sign; a non-finite value staysNone); it feedsbaseline_mean,treatment_mean, the per-taskbaseline,treatment,deltaand nowmde, and_round_off_zerois removed. Thechanged:line offormat_compareread the rounded task deltas to leave out noise: it now testsround(delta, 6), so it lists the same tasks as before (a delta of 4e-7 is still left out).dokimi/dokimi/eval/stats.py:delta_stdisround_off_zero(d_sd, 2). The import follows the layers (stats.pyalready imports fromeval.sign_flip); a non-finite spread is still refused before this line.dokimi/dokimi/repos/compare.py:_mde_textformats themdeof the inconclusive note.dokimi/tests/test_repo_compare_reading.pyanddokimi/tests/test_stats.py; the contract (dokimi/docs/repo-evaluation-contract.md) names the rounding of these fields and the note's formats. No existing test pinned0.0for a tiny value.Risk
Output only, no schema change (same keys and types). Values of 5e-7 and above, a
delta_stdof 0.005 and above, and anmdeof 0.0005 and above print as before. A storedrepo compareJSON differs from a new one on every per-task value and arm mean below 5e-7; a stored arms result differs on adelta_stdbelow 0.005; the note's text differs for a non-zeromdebelow 0.0005. A reader that treated0.0in those fields as "no change" now sees the small value. Open PRs that change the contract doc (#1252, #1243, #1201, #1199, #1194, #1192) edit other paragraphs than the two lines changed here, and #1199's change tocompare.pyis a warning message in_arm_warnings: a merge with any of them meets no conflict.Testing
On Linux, at
75b35980581c3f2dfcfd97ac3b6bb3f044fd9f33(onmain4abc47d):make ci-local: 38 passed, 0 failed, 15 skipped (the Docker and network catalog smoke, the pinned Claude Code install, the jobs that do not run on a PR, the CLI-surface packaging, conda-forge, fuzz, the intel-ci matrix, the pip-audit report, semgrep). 29688 tests passed, 23 skipped; changed-line coverage 100%.main's code,test_repo_compare_reading.pyfails 8 of its 34 tests (first:_round(-0.0)is-0.0; thentasks[0]is{'baseline': 0.0, 'delta': 0.0, 'treatment': 0.0}against1e-12, and the note reads±0.000against±2.6e-12) andtest_stats.pyfails the new test (assert (0.0 == 2.4e-12)); all of them pass here._roundback to 6 places,_rounddropping the sign,round_off_zerokeeping-0.0, thechanged:line back to theEPSfilter (that test passes onmaintoo: it guards this change), the note's tiny branch removed, cut at<= 0.0005, cut at0.005,.2einstead of.1e,delta_stdback toround(d_sd, 2)and at 3 places.Open questions
None.
Revert
A plain revert restores the old printing (
0.0for a tiny per-task value, arm mean ordelta_std;±0.000in the note). Nothing is stored: a JSON written meanwhile keeps its small values, and the schemas are unchanged.Checklist
pytestpassesruff,mypy, and schema checks passAGENTS.mdraise/exit and test names the doc, contract or issue it traces to.github/.licenserc.yaml)