Skip to content
Discussion options

You must be logged in to vote

To aggregate multiple metrics into one output, TorchMetrics provides the powerful MetricCollection class. This class allows you to wrap several metric objects into a single callable metric, enabling you to compute and log many metrics together and, if needed, manually aggregate their computed values.
If you want a single aggregated value (e.g., average or weighted sum of outputs), you can compute each metric, then combine their results as needed.
Here is a minimal code sample for combining two metrics and aggregating their values:

import torch
from torchmetrics import MetricCollection, F1

# Example: Define two metrics
entity_metric = F1(num_classes=NUM_ENTITIES, average="weighted")
relat…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Borda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants