Skip to content

Apply regression target transforms to the unnormalized target [RES-2639] - #1199

Merged
bejaeger merged 7 commits into
mainfrom
benjamin/res-2639-transform-unnormalized-target
Oct 28, 2026
Merged

bejaeger merged 7 commits into
mainfrom
benjamin/res-2639-transform-unnormalized-target

Conversation

@bejaeger

@bejaeger bejaeger commented Aug 21, 2026 •

Copy link
Copy Markdown
Collaborator

Generated by Codex

Apply regression target transforms such as log1p before final standardization so they receive targets in their original units. Keep input standardization inside the regression power and safepower presets to preserve its previous behavior when members use the full training set. This fixes the log1p domain problem while retaining the default transform semantics, subject to floating-point differences and member-specific statistics when subsampling.

Closes RES-2639. PR 2 of 2; #1198 has merged. This branch now targets main.

Transform order and default behavior
  • 1_plus_log: raw targets → log1p → standardize. Raw targets must still satisfy the log1p domain.
  • power and safepower: raw targets → standardize → existing power preset → final standardize. The existing preset already standardizes its output, so the final standardization is mathematically redundant but can introduce rounding differences.
  • None and "none": standardize only.

The power wrappers apply only to regression targets. Feature preprocessing is unchanged. Without subsampling, the values supplied to safepower match the former global-standardization path. With subsampling, members fit their own target statistics. Inverse transforms return raw units, then borders map back to the shared standardized aggregation space; matching statistics cancel mathematically, but bit-identical predictions are not guaranteed.

Validation and benchmark scope

Earlier review validation: 42 focused tests passed. Nine new cases failed before the changes (four power cases, four invalid log-domain cases, and the missing exp warning). Existing safepower input-equality and inverse tests remain green.

log now rejects raw targets <= 0 and 1_plus_log rejects raw targets <= -1 during fitting, with actionable errors. exp warns only when exp(y) would produce infinities in float32, reporting the affected target count. Safe inputs remain quiet. The transform retains raw-target semantics and does not guarantee numerical stability beyond this overflow diagnostic.

Earlier validation on main ffd53715 and the updated #1198 passed all 51 selected tests, covering target transforms, safepower, integer-target loss, near-constant frames, custom-loop state isolation, grouped shape safety, and config equivalence. Pre-commit checks pass. See #1198 for the broader base-layer validation and rebase fixes.

Earlier TabArena Lite default-only validation compared main f58bec9a against stack f1bdf93f on 13 regression datasets, one split each, using the same default v3.5 checkpoint and eight estimators on RTX Pro 6000 Flex. Reference calibration against 77 TabArena methods, with RF default anchored at 1,000, gave 2,250 Elo for main and 2,264 for the stack. Those results predate the safepower preservation change and do not validate the latest revision. No new accuracy or Elo claim is made for this update.

CPU accuracy test failure

The transform accuracy test now sets inference_precision=torch.float32. Automatic CPU precision selected bfloat16 on the Linux runner, but float32 on macOS. On Linux with PyTorch 2.5.0, NumPy 1.23.5, SciPy 1.11.1, and scikit-learn 1.4.2, the previous and current safepower pipelines produced identical predictions: R² 0.6911 in bfloat16 versus 0.7832 in float32. This reproduces the threshold failure without a change from the target-transform order.

The R² > 0.7 assertion and production precision defaults are unchanged. Rebased onto main d05cd1be after #1198 merged. All three patched accuracy cases pass on Linux with the minimum numerical dependencies. All 19 focused local tests and pre-commit checks pass; full CI is running.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@bejaeger
bejaeger force-pushed the benjamin/res-2639-transform-unnormalized-target branch from e7d29d7 to b38d26e Compare September 23, 2026 12:41
@bejaeger
bejaeger force-pushed the benjamin/res-2639-transform-unnormalized-target branch from b38d26e to 9d28c4d Compare September 23, 2026 12:57

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9d28c4d. Configure here.

Comment thread changelog/1199.changed.md Resolved
@bejaeger
bejaeger force-pushed the benjamin/res-2639-transform-unnormalized-target branch from 9d28c4d to 2b3d4bb Compare September 24, 2026 07:46
@bejaeger
bejaeger force-pushed the benjamin/res-2639-transform-unnormalized-target branch 2 times, most recently from 92fab0d to f1bdf93 Compare September 24, 2026 10:23
@bejaeger
bejaeger added this pull request to stack #1332 September 30, 2026 13:03
@bejaeger
bejaeger force-pushed the benjamin/res-2639-transform-unnormalized-target branch 2 times, most recently from 8e59d43 to 57d49a8 Compare October 13, 2026 10:31
@bejaeger
bejaeger force-pushed the benjamin/res-2639-transform-unnormalized-target branch from 57d49a8 to a9560fe Compare October 23, 2026 12:45
LeoGrin
LeoGrin previously approved these changes Oct 26, 2026

@LeoGrin LeoGrin left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, and sorry for the super late review!

LGTM, a few comments:

  • log or 1_plus_log: now on invalid ys (<=0 or <= -1), fit works, but predict crashes with a weird error: ValueError: zero-size array to reduction operation maximum which has no identity. Should we add some validation and crash nicely?
  • power: IIUC now we still standardize y before safepower but not power, which is weird? Could also be time to get rid of this one, and for the time being just keep the option but make it an alias of safepower? Another option is the opposite: get rid of safepower. It was meant as a temporary solution waiting for the moment we could drop the older scikit-learn versions. IIUC we would need to restrict to sklearn >= 1.7.0 (16½ months old) and scipy>=1.12 (2 years 9 months old), so the newest we would drop would be sklearn 1.6.1 (2025-01-10, about 21½ months old). Our policy is to support up to 3 years old so maybe not yet? :'(
  • exp: now quite easy to overflow. In the best case we get an error (like for log) that we could make nicer, but in the worse case it seems that a wide range of y just make the z-score collapse the values (with a RuntimeWarning: invalid value encountered in log). Not sure how to best handle this? We could standardize before exp like before, though it might not be very intuitive that we do it for exp but not log. We could also check the number of unique values before / after the transform but not sure how robust it is. I'm also not sure if this option is really used so wouldn't be opposed to depreciating it 🤔

github-actions[bot]
github-actions Bot previously approved these changes Oct 28, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reapproving after a push, as this is a PR from an internal author and was already approved.

github-actions[bot]
github-actions Bot previously approved these changes Oct 28, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reapproving after a push, as this is a PR from an internal author and was already approved.

github-actions[bot]
github-actions Bot previously approved these changes Oct 28, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reapproving after a push, as this is a PR from an internal author and was already approved.

@bejaeger

Copy link
Copy Markdown
Collaborator Author

Thanks for the review! I kept our lives easy for this one and:

  • log / 1_plus_log: added an informative warning
  • exp: added a warning in case overflows happen
  • power: I kept it in and also do standardization. if we want a safepower and power without, let's do that in a follow-up

Base automatically changed from benjamin/res-2639-target-encoder-refactor to main October 28, 2026 13:16
@bejaeger
bejaeger force-pushed the benjamin/res-2639-transform-unnormalized-target branch from 130de98 to a57a6ef Compare October 28, 2026 13:16
github-actions[bot]
github-actions Bot previously approved these changes Oct 28, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reapproving after a push, as this is a PR from an internal author and was already approved.

@bejaeger
bejaeger enabled stacked auto-merge October 28, 2026 13:17
@bejaeger
bejaeger force-pushed the benjamin/res-2639-transform-unnormalized-target branch from a57a6ef to 4232971 Compare October 28, 2026 15:33

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reapproving after a push, as this is a PR from an internal author and was already approved.

@bejaeger
bejaeger added this pull request to the merge queue Oct 28, 2026
Merged via the queue into main with commit 1c0a457 Oct 28, 2026
17 checks passed
@bejaeger
bejaeger deleted the benjamin/res-2639-transform-unnormalized-target branch October 28, 2026 16:56
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