FIX DUMMY: avoid spurious out-of-range threshold warning - #17
Open
JayeshSuryavanshi wants to merge 1 commit into
Open
FIX DUMMY: avoid spurious out-of-range threshold warning#17JayeshSuryavanshi wants to merge 1 commit into
JayeshSuryavanshi wants to merge 1 commit into
Conversation
DUMMY.eval adds eps to the percentile threshold so the top-scoring point stays an inlier at contam=0 (cut uses decision >= limit), but passed the eps-bumped limit to _check_threshold. When the percentile is the maximum (== 1 on min-max normalized scores), limit == 1 + eps > 1 and tripped the "threshold outside the range" warning on every default call (the test suite triggered it 10 times, all from tests/test_dummy.py). Validate the in-range percentile instead; the stored thresh_ and the returned labels are unchanged. Adds a regression test.
Author
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.
Submissions Basics:
Type of Change:
All Submissions Cores:
What & why
DUMMYemits a spuriousUserWarning("Computed threshold 1.0000000000000002 is outside the range of 0 and 1") on every default call — the repo's own suite triggers it 10 times, all fromtests/test_dummy.py.Decision scores are min-max normalized to
[0, 1], sonp.percentile(decision, perc)is in[0, 1].evaladdseps(limit = percentile + eps) so the top-scoring point stays an inlier atcontam=0(cutusesdecision >= limit). It then passed that eps-bumpedlimitto_check_threshold, so a maximum percentile (== 1) madelimit == 1 + eps > 1and tripped the range guard — even though the threshold is valid and the labels are correct.This validates the in-range percentile with
_check_thresholdinstead of the eps-bumpedlimit. The storedthresh_and the returned labels are unchanged (all pre-existingDUMMYtests still pass); only the spurious warning is gone.tests/test_dummy.py::test_no_spurious_threshold_warning, asserting no out-of-range warning across the contam grid.CHANGES.txtentry (happy to retag the version if you'd prefer a different one).ruff checkclean;pytest tests/test_dummy.py→ 20 passed, 0 warnings.