Repository navigation
fix(metrics): reject non-finite metric results - #195
Open
DevChiniwala wants to merge 1 commit into
Open
DevChiniwala wants to merge 1 commit into
DevChiniwala wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
compute_metricandcompute_metric_hardcodedcan return non-finite scores. For example, R² on a one-row validation set emitsUndefinedMetricWarningand returnsNaN; 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
ValueErrorforNaNor either infinity. Finite0.0remains 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 warningsuv tool run --from poetry poetry run black --check .— passeduv tool run --from poetry poetry run ruff check .— passedgit diff --check— passed