-
Notifications
You must be signed in to change notification settings - Fork 401
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 for Wrappers (e.g., BootStrapper
) in MetricCollection
#2046
Comments
Hi @pietrolesci, thanks for reporting this issue. metrics_dict = MetricCollection({"acc": bootstrap_acc, "f1": bootstrap_f1})
print(metrics_dict(preds, target)) using v1.1.1 of torchmetrics you should get something like:
Closing issue. |
Thanks a lot for your swift reply @SkafteNicki! |
Hi @SkafteNicki, The behaviour of the For a case like metrics_dict = MetricCollection({"acc": bootstrap_acc}) I think the expected output should be
because the user passed a key which likely makes sense for them. I have this problem when I have multiple metrics in the for {
"bootf1_micro": BootStrapper(F1Score(task, num_classes=num_classes, average=average)),
"accuracy_micro": Accuracy(task, num_classes=num_classes, average=average),
"f1_micro": F1Score(task, num_classes=num_classes, average=average),
"precision_micro": Precision(task, num_classes=num_classes, average=average),
"recall_micro": Recall(task, num_classes=num_classes, average=average),
} {
'mean': tensor([0.4939, 0.7287, 0.0000]), # this should have been bootf1_micro_mean
'std': tensor([0.1622, 0.1454, 0.0000]), # this should have been bootf1_micro_std
'accuracy_micro': tensor(0.5000),
'f1_micro': tensor(0.5000),
'precision_micro': tensor(0.5000),
'recall_micro': tensor(0.5000),
} |
🚀 Feature
Allow to pass two bootstrappers to
MetricCollection
as a dict.Motivation
Currently the behaviour is the following.
If
MetricCollection
is build as alist
of metrics, aValueError
is thrownIf
MetricCollection
is build as adict
of metrics, results are conflatedthe expected behaviour could be a flattened
dict
where the keys are prepended to the statisticsor a nested
dict
The text was updated successfully, but these errors were encountered: