Skip to main content

scorebook.metrics.metric_base

Base class for evaluation metrics.

MetricBase Objects

class MetricBase(ABC)

Base class for all evaluation metrics.

name

@property
def name() -> str

Return the metric name based on the class name.

score

@staticmethod
@abstractmethod
def score(outputs: List[Any],
labels: List[Any]) -> Tuple[Dict[str, Any], List[Any]]

Calculate the metric score for a list of outputs and labels.

Arguments:

  • outputs - A list of inference outputs.
  • labels - A list of ground truth labels.

Returns:

Aggregate metric scores for all items. Individual scores for each item.