Skip to content

Comments

fix(constraints): consider numeric/datetime extreme value clipping#700

Merged
michdr merged 5 commits intomainfrom
fix-ineq-clipping
Jan 9, 2026
Merged

fix(constraints): consider numeric/datetime extreme value clipping#700
michdr merged 5 commits intomainfrom
fix-ineq-clipping

Conversation

@michdr
Copy link
Contributor

@michdr michdr commented Jan 9, 2026

Note

Imposes training-bound clipping for Inequality constraints and wires workspace context through constraint translation and generation.

  • Add workspace_dir plumbed through ConstraintTranslator and _create_constraint_handler to InequalityHandler
  • Enhance InequalityHandler to clip high_column to training stats min/max via Workspace.tgt_stats for both numeric and datetime; add helpers _extract_min_max_from_stats and _clip_to_training_bounds
  • Update data generation step to pass workspace_dir and post-process synthetic parquet with the updated translator
  • Adjust e2e test: assert clipping for ELAPSED_TIME and ARRIVAL_TIME, relax strict mean-time check (commented) and require most time deltas within 2–3 hours

Written by Cursor Bugbot for commit 8b41828. This will update automatically on new commits. Configure here.

@michdr michdr marked this pull request as ready for review January 9, 2026 14:27
@michdr michdr requested a review from a team as a code owner January 9, 2026 14:28
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on January 17

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

high = df[self.high_column]
both_valid = low.notna() & high.notna()
violations = both_valid & (high < low)
df.loc[violations, self.high_column] = low[violations]
Copy link

Choose a reason for hiding this comment

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

Clipping can be undone by constraint correction

Medium Severity

The _clip_to_training_bounds method clips high_column values to training bounds, then at lines 190-195 sets high = low if the clipping caused a constraint violation. When low_column values exceed the training max for high_column, this correction pushes high back outside the training bounds, effectively undoing the clipping. This can cause test assertions expecting values within bounds to fail in edge cases where the model generates extreme low_column values.

Fix in Cursor Fix in Web

@michdr michdr merged commit 02c5858 into main Jan 9, 2026
14 checks passed
@michdr michdr deleted the fix-ineq-clipping branch January 9, 2026 15:34
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.

1 participant