You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When F1 (Macro) is calculated on a batch where one (or more) labels never appear, the result is <1.0 even when all predictions are correct. This seems very counterintuitive. Is it expected?
To Reproduce
import torch
from torchmetrics import F1
f1=F1(num_classes=2, average='macro')(preds=torch.tensor([0,0]), target=torch.tensor([0,0]))
print(f1)
Output: 0.5.
This occurs if one of my batches lacks one (or more) of the labels (my real use-case has many more classes).
Expected behavior
I'm not an expert on how F1 is calculated, but I would expect the output to be 1.0.
🐛 Bug
When F1 (Macro) is calculated on a batch where one (or more) labels never appear, the result is <1.0 even when all predictions are correct. This seems very counterintuitive. Is it expected?
To Reproduce
Output:
0.5
.This occurs if one of my batches lacks one (or more) of the labels (my real use-case has many more classes).
Expected behavior
I'm not an expert on how F1 is calculated, but I would expect the output to be
1.0
.Environment
The text was updated successfully, but these errors were encountered: