MultiLabelClassificationOutput#

class torch_ecg.components.MultiLabelClassificationOutput(*args: Any, **kwargs: Any)[source]#

Bases: BaseOutput

Class that maintains the output of a multi-label classification task.

Parameters:
  • classes (Sequence[str]) – class names

  • thr (float) – threshold for making binary predictions

  • prob (numpy.ndarray) – Probabilities of each class, of shape (batch_size, num_classes)

  • pred (numpy.ndarray) – Binary predictions, of shape (batch_size, num_classes).

compute_metrics(macro: bool = True) → ClassificationMetrics[source]#

Compute metrics from the output.

Parameters:

macro (bool) – Whether to use macro-averaged metrics or not.

Returns:

metrics – Metrics computed from the output.

Return type:

ClassificationMetrics

required_fields() → Set[str][source]#

The required fields of the output class.