Skip to content

Commit

Permalink
fix duplicate mask in f1_score (#145)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: #145

Reviewed By: ananthsub

Differential Revision: D45188253

fbshipit-source-id: 6b29497cb849af78f80ea8aefdf7585a9476ac8a
  • Loading branch information
JKSenthil authored and facebook-github-bot committed Apr 21, 2023
1 parent 30c6954 commit d53fa32
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions torcheval/metrics/functional/classification/f1_score.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ def _f1_score_compute(
elif average == "macro":
return f1.mean()
elif average == "weighted":
# pyre-fixme[61]: `mask` is undefined, or not always defined.
return (f1 * (num_label[mask] / num_label.sum())).sum()
return (f1 * (num_label / num_label.sum())).sum()
else: # average is None
return f1

Expand Down

0 comments on commit d53fa32

Please sign in to comment.