Skip to content

euroeval.metrics.base

source module euroeval.metrics.base

The abstract base class for all metrics.

Classes

  • Metric Abstract base class for all metrics.

source class Metric(name: str, pretty_name: str, postprocessing_fn: t.Callable[[float], tuple[float, str]] | None = None)

Bases : abc.ABC

Abstract base class for all metrics.

Initialise the metric.

Parameters

  • name : str The name of the metric in snake_case.

  • pretty_name : str The pretty name of the metric, used for display purposes.

  • postprocessing_fn : t.Callable[[float], tuple[float, str]] | None A function to apply to the metric scores after they are computed, taking the score to the postprocessed score along with its string representation. Defaults to x -> (100 * x, f"{x:.2%}").

Methods

  • download Initiates the download of the metric if needed.

source method Metric.download(cache_dir: str)Metric

Initiates the download of the metric if needed.

Parameters

  • cache_dir : str The directory where the metric will be downloaded to.

Returns

  • Metric The metric object itself.