Fix BinaryMetricStats DER denominator - #3078
Open
Kayvan-Zahiri wants to merge 1 commit into
Open
Kayvan-Zahiri wants to merge 1 commit into
Kayvan-Zahiri wants to merge 1 commit into
Conversation
DER was divided by the number of correct decisions (TP + TN) rather than the number of decisions, so it did not match the equal error rate at the automatic threshold as documented, and could exceed 1.0. On the existing unit test data it returned 2.0 where the EER is 0.667. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TLWefdPAbf8QT4fS8Pkk68
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.
What does this PR do?
BinaryMetricStats.summarizedivided the detection errors by the number of correct decisions instead of by the number of decisions:The docstring says
DER - Detection Error Rate (EER if no threshold passed), but the two did not agree. On the data already intests/unittests/test_metrics.pythe automatic threshold gives FAR = FRR = 0.667, so the EER is 0.667, whilesummary["DER"]came back as 2.0. With a fixed threshold and no correct decisions at all, the old expression divided byepsand returned 4e+08.The denominator is now
TP + TN + FP + FN, which makes DER equal the EER at the automatic threshold. Every other field of the summary is unchanged.A 2021 commit (f3f9b38, "Correct FAR and FRR") fixed the same denominator for FAR and FRR and left DER alone.
The regression test covers both the fixed-threshold value and the equality with the EER.
Before submitting
DERwas previously unusable and is asserted nowhere)