fix(validation): correct argument validation in auroc, logauc, and pesq metrics - #3441
Open
AbdullahRasheed45 wants to merge 1 commit into
Open
Conversation
…sq metrics Four more instances of the same 'and' vs 'or' logical operator bug found in the broader codebase, affecting different metric families. - PerceptualEvaluationSpeechQuality (audio/pesq.py): n_processes=0 or a negative integer was accepted without raising an error. - BinaryAUROC functional API (functional/classification/auroc.py): max_fpr as an out-of-range float (e.g. 2.0) was accepted without error because the condition was 'not isinstance(float) AND in range (0,1]' instead of 'not isinstance(float) OR not in range (0,1]'. - RetrievalAUROC class API (retrieval/auroc.py): Same max_fpr bug as above in the class __init__. - BinaryLogAUC / MulticlassLogAUC / MultilabelLogAUC (functional/classification/logauc.py): fpr_range validation used 'and' instead of 'or', so a list of length 2 would bypass the tuple type check. Fix: replace 'and' with 'or' (and restructure the max_fpr check using De Morgan's law) so that an invalid argument raises ValueError when either the type check or the value check fails.
AbdullahRasheed45
requested review from
SkafteNicki and
justusschock
as code owners
July 31, 2026 02:22
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.
Summary
Four more instances of the same
andvsorlogical operator bug in argument validation, affecting the AUROC, LogAUC, and PESQ metrics. These are the remaining sites not covered by PR #3440.The Bug
Each guard uses
andwhereoris required:This means a value with a correct type but invalid range silently bypasses the check.
Files Changed
audio/pesq.pyn_processesn_processes=0(int, but ≤ 0)functional/classification/auroc.pymax_fprmax_fpr=2.0(float, but outside (0, 1])retrieval/auroc.pymax_fprfunctional/classification/logauc.pyfpr_rangefpr_range=[0.001, 0.1](list of len 2, not tuple)Reproduction
Related
top_kin stat_scores and retrieval metrics.