Repository navigation
Fix the flaky bias assertion in test_fit_summaries - #450
Conversation
The regression fit test compared the summary bias with a float32 mean. Both holdout columns are float32. So pandas subtracted them in float32, and numpy averaged the result in float32. Positive and negative errors cancel in the mean, so this rounding moved the reference by 1.2e-6 to 2.0e-6 relative in CI. The default tolerance of pytest.approx is 1e-6. evaluation_counts converts pred and target to float64 before it sums them. The test now does the same conversion before it subtracts. Then the reference bias equals the summary bias. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
Note
|
Change mapObserved failure:
|
test_regression_test_summaries_count_every_holdout_rowfails now and then, because it compares the summary bias with a float32 mean. This PR computes that mean in float64, as the product code does.Design discussion or issue: none. Failed runs: main, 2026-11-16 and #443, 2026-11-20.
Summary
What changes
The test gets the reference error of each holdout row as
TARGET_PRED - TARGET. It now converts both columns to float64 before the subtraction. No product code changes.Why it changes
The bias assertion failed in CI with a relative gap of 1.2e-6 and 2.0e-6. The default tolerance of
pytest.approxis 1e-6.Both holdout columns are float32. On main, pandas subtracts them in float32, and numpy averages the result in float32. Positive and negative errors cancel in the mean. So a small float32 rounding error in each row becomes a large share of a small bias.
Before and now
evaluation_counts_floatsconverts both columnsWhy this is better
Thirty local fits of the same graph and query, with data seeds 1 to 30, gave these results:
A fixed float32 frame with 300 rows and a bias of 0.0020 fails with the main reference, in the same way as CI:
assert 0.0020043918723240493 == 0.002004397800192237 ± 2.0e-09. With the new reference, it passes.Trade-off
The MAE assertion uses the same
error. It now compares the float32test_maemetric with an exact float64 mean. In the same 30 fits, its largest relative gap was 1.2e-7. On main, it was 1.5e-7. Both are far below 1e-6.Change map
See the change-map comment.
Testing Done
packages/kumo-engine/test/test_fit_summaries.py: 4 passed. This run and the 30 fits used main as of Fix decimal decoding in Kumo DiskGraph event and graph inputs #348 (2026-11-16) plus an unrelated AutoML error-message change, because the local DiskGraph build is older than Separate DiskGraph seed scheduling from batch sampling #427. The test file and the regression count code did not change after Fix decimal decoding in Kumo DiskGraph event and graph inputs #348.packages/kumo-core/tests/test_evaluation_counts.py,test_prediction_counts.py,test_score_counts.py,test_evaluation_budget.pyandtests/evaluationon current main: 135 passed, 8 skipped (no CUDA or MPS).setup.cfg: no findings. yapf: no change on the changed lines.Hotfix Context
Not a hotfix.
Checklist
🤖 Generated with Claude Code