Skip to content

Fix the flaky bias assertion in test_fit_summaries - #450

Merged
anle2024 merged 2 commits into
mainfrom
anle/regression-float64-totals
Nov 23, 2026
Merged

anle2024 merged 2 commits into
mainfrom
anle/regression-float64-totals

Conversation

@anle2024

@anle2024 anle2024 commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

test_regression_test_summaries_count_every_holdout_row fails 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.approx is 1e-6.

Run Summary bias (obtained) Test reference (expected) Relative gap
main push, 2026-11-16 0.0019030134 0.0019030158 1.2e-6
#443, 2026-11-20 0.0013620214 0.0013620186 2.0e-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

Step Main This PR
Summary bias in evaluation_counts float64, because _floats converts both columns The same
Reference error in the test float32 subtraction float64 subtraction
Reference mean in the test float32 sum float64 sum
Gap between summary bias and reference Up to 2.0e-6 in CI 0.0

Why this is better

Thirty local fits of the same graph and query, with data seeds 1 to 30, gave these results:

Reference Fits with a bias gap over 1e-6 Largest bias gap
float32 (main) 2 of 30 1.8e-6
float64 (this PR) 0 of 30 0.0 in all 30

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 float32 test_mae metric 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

Hotfix Context

Not a hotfix.

Checklist

  • I listed all the breaking changes introduced by the PR: none.
  • I made sure to update examples and documentation with my changes (if necessary): none needed.
  • I have added and modified unit tests required to cover changes made by this PR.

🤖 Generated with Claude Code

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]>
@copy-pr-bot

copy-pr-bot Bot commented Nov 21, 2026

Copy link
Copy Markdown

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.

@anle2024
anle2024 temporarily deployed to gha-kumo-workflow-tests November 21, 2026 00:18 — with GitHub Actions Inactive
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Explain Change →

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

Parsing warnings: 1

Validation error: Unrecognized key: "tone_instructions" at "reviews"
Configuration instructions

  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

No actionable comments were generated in the recent review.

Walkthrough

The regression-summary test converts the holdout prediction and target arrays to NumPy float64 before subtracting them. The resulting error is used in the existing metric and bias assertions.

Merge Risk: Minimal · up to e2dc8

This change only makes a flaky test's reference calculation more precise and does not alter product behavior. No merge-blocking risk was found.

Security architecture risk: Minimal · up to e2dc8

The change makes the regression test less sensitive to floating-point rounding without changing how the engine handles holdout data or reports metrics.

Pre-merge checks: Passed 2 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Change Map Design Review Inconclusive The check reviews the PR conversation comment that starts with <!-- kumo-pr-change-map -->. That comment body is not available to me. It is not in the checkout, the git refs, or the supplied context… Provide the complete body of the PR conversation comment that starts with <!-- kumo-pr-change-map --> on NVIDIA/kumo-engine PR #450, or make it available in the review context. Then rerun the "Change map design review" check. The check ne…
Passed Passed checks: 2 passed

Check name Status Explanation
Pr Size Passed The PR size check counts changed files and fails only when the count exceeds 40. The reviewed diff range (refs/coderabbit/pre-merge-check/base to refs/coderabbit/pre-merge-check/head) changes exactly …
Public Resource Access Passed The check covers external resource references whose text this PR adds or modifies. The PR changes one file, packages/kumo-engine/test/test_fit_summaries.py (+2/-1, lines 89-98 of the new file). The …
Full details: Pr Size

Explanation

The PR size check counts changed files and fails only when the count exceeds 40. The reviewed diff range (refs/coderabbit/pre-merge-check/base to refs/coderabbit/pre-merge-check/head) changes exactly one file: packages/kumo-engine/test/test_fit_summaries.py (status M). git diff --name-only returned 1 entry, and git diff --stat reports "1 file changed, 2 insertions(+), 1 deletion(-)". The count of 1 does not exceed 40, so the check passes. Line counts were ignored as the check requires.

Full details: Public Resource Access

Explanation

The check covers external resource references whose text this PR adds or modifies. The PR changes one file, packages/kumo-engine/test/test_fit_summaries.py (+2/-1, lines 89-98 of the new file). The patch adds only float64 conversions and no URL, repository location, or package source location. A search of the added lines for http(s)://, git@, github.com, package-index and archive patterns found nothing. The PR description contains links to CI runs and a PR change-map comment. Those links are not in the changed repository content. They are context for the bug report, not resources needed to understand, build, test, or contribute to the changed test code. The check excludes unchanged and out-of-scope references, so they do not trigger this check. If a reviewer requires the description links to be public, that is a separate policy and was not tested here.

Full details: Change Map Design Review

Explanation

The check reviews the PR conversation comment that starts with &lt;!-- kumo-pr-change-map --&gt;. That comment body is not available to me. It is not in the checkout, the git refs, or the supplied context. The only supplied material is an LLM-written "Comments summary" in the objectives. That summary cannot replace the comment's own Change map, observed-failure statement, inspected-behavior notes, verification list, or stopping condition, so I cannot assess the map as the check requires. Evidence I could verify: - Primary PR: NVIDIA/kumo-engine #450, base main, head anle/regression-float64-totals, author anle2024 (verified). - The diff range changes one file, packages/kumo-engine/test/test_fit_summaries.py, with +2/-1. The test now converts TARGET_PRED and TARGET to float64 before subtracting. The assertions themselves are unchanged. - In packages/kumo-core/src/kumo_core/evaluation_counts.py, _floats (lines 71-72) already converts regression and forecasting inputs to float64. The test's new reference therefore matches the product's precision. That supports the description's claim of no product change. - The description's failure evidence (relative gaps 1.2e-6 and 2.0e-6 against the pytest.approx default of 1e-6) is consistent with a float32 reference. I did not rerun the test, because build tooling is unavailable. Design points to check against the comment once it is available: - The MAE assertion now compares the float32 test_mae metric with a float64 mean. The description reports a relative gap of 1.2e-7. Confirm that the comment states this trade-off. - The description says "No product code changes" and cites a change-map comment. Confirm that the map explains why the test, not the product bias calculation, is the right layer for the fix. Required next step: provide the full body of the &lt;!-- kumo-pr-change-map --&gt; comment (or a fetch that returns it) and rerun this check.

Resolution

Provide the complete body of the PR conversation comment that starts with &lt;!-- kumo-pr-change-map --&gt; on NVIDIA/kumo-engine PR #450, or make it available in the review context. Then rerun the "Change map design review" check. The check needs the comment's own Change map, observed-failure statement, inspected existing behavior, verification plan, and stopping condition.

Finishing Touches

Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 76d4b2e and e2dc83f.

Files selected for processing: 1

  • packages/kumo-engine/test/test_fit_summaries.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

@anle2024

Copy link
Copy Markdown
Collaborator Author

Change map

Observed failure: test_regression_test_summaries_count_every_holdout_row failed at the bias assertion on main (2026-11-16) and on #443 (2026-11-20). The relative gap was 1.2e-6 and 2.0e-6, over the 1e-6 default tolerance of pytest.approx.
Existing behavior: both holdout columns are float32. The test subtracted them and averaged the result in float32. evaluation_counts converts both columns to float64 before it sums them.
Smallest sufficient change: convert both columns to float64 in the test before the subtraction.
Focused verification: in 30 local fits, the main reference failed 2 times and the new reference failed 0 times, with a bias gap of 0.0. The test file passes.
Stopping condition: the reference bias equals the summary bias, and the MAE assertion stays within its tolerance.
Kept separate: the binary and forecast assertions in the same file. Their sums add values with one sign, so the rounding does not grow through cancellation.

File Function / scope What changed Why
packages/kumo-engine/test/test_fit_summaries.py test_regression_test_summaries_count_every_holdout_row Convert TARGET_PRED and TARGET to float64 before the subtraction The float32 reference bias missed the float64 summary bias by up to 2.0e-6 relative

@anle2024
anle2024 marked this pull request as ready for review November 23, 2026 20:58
@anle2024
anle2024 temporarily deployed to gha-kumo-workflow-tests November 23, 2026 20:59 — with GitHub Actions Inactive
@nivle1661
nivle1661 self-requested a review November 23, 2026 21:14
@anle2024
anle2024 merged commit d6b082c into main Nov 23, 2026
119 of 120 checks passed
@anle2024
anle2024 deleted the anle/regression-float64-totals branch November 23, 2026 22:42

This branch was previously deployed

1 inactive deployment
gha-kumo-workflow-tests — e2dc83ff Deployed Nov 23, 2026 by anle2024 via import #3100
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.

2 participants