Skip to content

Fix BinaryMetricStats DER denominator - #3078

Open
Kayvan-Zahiri wants to merge 1 commit into
speechbrain:developfrom
Kayvan-Zahiri:fix-binary-der-denominator
Open

Kayvan-Zahiri wants to merge 1 commit into
speechbrain:developfrom
Kayvan-Zahiri:fix-binary-der-denominator

Conversation

@Kayvan-Zahiri

Copy link
Copy Markdown

What does this PR do?

BinaryMetricStats.summarize divided the detection errors by the number of correct decisions instead of by the number of decisions:

self.summary["DER"] = (FP + FN) / (TP + TN + eps)

The docstring says DER - Detection Error Rate (EER if no threshold passed), but the two did not agree. On the data already in tests/unittests/test_metrics.py the automatic threshold gives FAR = FRR = 0.667, so the EER is 0.667, while summary["DER"] came back as 2.0. With a fixed threshold and no correct decisions at all, the old expression divided by eps and 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
  • Did you read the contributor guideline?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (the existing docstring already describes the corrected behavior)
  • Did you write any new necessary tests?
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request? (none; DER was previously unusable and is asserted nowhere)
  • Does your code adhere to project-specific code style and conventions?

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

1 participant