Skip to content

fix(metrics): reject non-finite metric results - #195

Open
DevChiniwala wants to merge 1 commit into
plexe-ai:mainfrom
DevChiniwala:fix/reject-non-finite-metrics
Open

DevChiniwala wants to merge 1 commit into
plexe-ai:mainfrom
DevChiniwala:fix/reject-non-finite-metrics

Conversation

@DevChiniwala

@DevChiniwala DevChiniwala commented Oct 10, 2026 •

Copy link
Copy Markdown

Problem

compute_metric and compute_metric_hardcoded can return non-finite scores. For example, R² on a one-row validation set emits UndefinedMetricWarning and returns NaN; the workflow accepts it because it is non-None, allowing an undefined score to enter search state.

Fix

Validate results at both public metric helpers and raise ValueError for NaN or either infinity. Finite 0.0 remains valid. Candidate evaluation already records metric exceptions as failed solutions.

Regression coverage

Tests exercise real sklearn metric calculations through both public helpers: one-row R² (NaN), overflow to positive and negative infinity, and valid zero accuracy.

Validation

  • uv tool run --from poetry poetry run pytest tests/unit/ -q --tb=short — 112 passed, 15 skipped, 3 existing warnings
  • uv tool run --from poetry poetry run black --check . — passed
  • uv tool run --from poetry poetry run ruff check . — passed
  • git diff --check — passed
  • Staged integration suite not run; repository guidance requires an Anthropic API key, and no live LLM calls were used.

Copilot AI balanced review requested due to automatic review settings October 10, 2026 04:55

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@DevChiniwala

Copy link
Copy Markdown
Author

The current-head validation workflows for this PR and #196 remain awaiting maintainer approval: #195 Integration / Version Check, and #196 Integration / Version Check. Could a maintainer approve the relevant checks before review? The local unit results in each PR body are not an upstream integration pass; no live provider calls or test credentials were used in this follow-up.

This branch has not been deployed

No deployments
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