SequenceLabellingOutput#

class torch_ecg.components.SequenceLabellingOutput(*args: Any, **kwargs: Any)#

Bases: BaseOutput

Class that maintains the output of a sequence tagging task.

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

  • prob (numpy.ndarray) – Probabilities of each class at each time step (each sample point), of shape (batch_size, signal_length, num_classes).

  • pred (numpy.ndarray) – Predicted class indices at each time step (each sample point), of shape (batch_size, signal_length); or binary predictions at each time step (each sample point), of shape (batch_size, signal_length, num_classes).

compute_metrics(macro: bool = True) → ClassificationMetrics#

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]#

The required fields of the output class.