fl4health.metrics.metric_managers module¶
- class MetricManager(metrics, metric_manager_name)[source]¶
Bases:
object
- __init__(metrics, metric_manager_name)[source]¶
Class to manage a set of metrics associated to a given prediction type.
- clear()[source]¶
Clears data accumulated in each metric for each of the prediction type.
- Return type:
- compute()[source]¶
Computes set of metrics for each prediction type.
- Returns:
dictionary containing computed metrics along with string identifiers for each prediction type.
- Return type:
Metrics
- update(preds, target)[source]¶
Updates (or creates then updates) a list of metrics for each prediction type.
- Parameters:
preds (TorchPredType) – A dictionary of preds from the model
target (TorchTargetType) – The ground truth labels for the data. If target is a dictionary with more than one item, then each value in the preds dictionary is evaluated with the value that has the same key in the target dictionary. If target has only one item or is a
torch.Tensor
, then the same target is used for all predictions.
- Return type: