-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support ignore_index in ConfusionMatrix #1101
Comments
Hi! thanks for your contribution!, great first issue! |
Issue will be fixed by classification refactor: see this issue #1001 and this PR #1195 for all changes Small recap: Issue ask that import torch
from torchmetrics.classification import BinaryConfusionMatrix
target = torch.tensor([1, 1, 0, 0, -1])
preds = torch.tensor([0, 1, 0, 0, 1])
confmat = BinaryConfusionMatrix(num_classes=2, ignore_index=-1)
confmat(preds, target)
# tensor([[2, 0],
# [1, 1]]) Issue will be closed when #1195 is merged. |
🚀 Feature
Add an
ignore_index
parameter to the classification metricConfusionMatrix
, as inAccuracy
,Precision
,Recall
, etc...Motivation
I use a
MetricCollection
for my classifier evaluation, and every other metric in this collection supportsignore_index
exceptConfusionMatrix
. This causes a lot of trouble and I don't see a reason for not supporting it.Pitch
ConfusionMatrix
should supportignore_index
so this should work totally fine:and output:
Alternatives
I tried implementing my own
IgnoreIndexConfusionMatrix
but I encountered device synchronization issues...The text was updated successfully, but these errors were encountered: