-
Notifications
You must be signed in to change notification settings - Fork 411
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
True update() for MetricCollection #203
Comments
You can use import torch
from torchmetrics import MetricCollection, Accuracy, Precision, Recall, ConfusionMatrix
target = torch.tensor([0, 2, 0, 2, 0, 1, 0, 2])
preds = torch.tensor([2, 1, 2, 0, 1, 2, 2, 2])
metrics = MetricCollection([
Accuracy(),
Precision(num_classes=3, average='macro'),
Recall(num_classes=3, average='macro')
])
print(metrics)
>>>MetricCollection(
>>> (Accuracy): Accuracy()
>>> (Precision): Precision()
>>> (Recall): Recall()
>>>)
# call super
super(type(metrics), metrics).update({'confmat': ConfusionMatrix(num_classes=3)})
print(metrics)
>>>MetricCollection(
>>> (Accuracy): Accuracy()
>>> (Precision): Precision()
>>> (Recall): Recall()
>>> (confmat): ConfusionMatrix()
>>>) |
@SkafteNicki Makes sence. Thanks! |
@IgorHoholko you are welcome. Closing the issue. Feel free to re-open if necessary :] |
Should we do something like
? |
@maximsch2 It would definitely be helpful. |
|
fine by me :] |
@SkafteNicki Yes, a bit later. |
🚀 Feature
MetricCollection
class overridesupdate
method of parentnn.ModuleDict
class. Is it possible to addupdate
from parent's class to MetricCollection?Example of using
The text was updated successfully, but these errors were encountered: