ClassificationOutput#

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

Bases: BaseOutput

Class that maintains the output of a (typically single-label) classification task.

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

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

  • pred (numpy.ndarray) – Predicted class indices of shape (batch_size,), or binary predictions of shape (batch_size, num_classes).

compute_metrics() → ClassificationMetrics[source]#

Compute metrics from the output.

Returns:

metrics – Metrics computed from the output.

Return type:

ClassificationMetrics

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

The required fields of the output class.