⚡ Sangsakala Proxy 🏠 Home
Skip to content

Respect positive_label in binary metric counts - #3111

Open
akshitkhokhani wants to merge 1 commit into
speechbrain:developfrom
akshitkhokhani:codex/fix-binary-metric-positive-label
Open

akshitkhokhani wants to merge 1 commit into
speechbrain:developfrom
akshitkhokhani:codex/fix-binary-metric-positive-label

Conversation

@akshitkhokhani

Copy link
Copy Markdown

What does this PR do?

Make BinaryMetricStats use its configured positive_label when calculating confusion counts and derived metrics. Threshold estimation already uses that label, but the confusion calculation treats the original labels as a 0/1 mask. A perfectly separated classifier with positive class encoded as 0 consequently reports F1=0; other encodings can produce negative false-positive counts.

The change creates a local binary truth mask without changing stored labels, threshold selection, or the DER formula. Regression coverage checks equivalent encodings with fixed and automatic thresholds, integer and floating labels, explicit confusion counts, repeated summaries, and unchanged labels.

Validation: the new regression fails in eight custom-label cases on the original source while four default-label controls pass. With the fix, CPU metric unit tests and module doctests pass (29 tests), and all repository pre-commit checks pass. No new dependency.

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