MetricManager#

class MetricManager(*metric_wrappers)#

A class to manage scoring metrics.

Provides access to various scoring metrics, allowing retrieval by either their full names or common abbreviations.

Parameters:
*metric_wrappersMetricWrapper

Instances of MetricWrapper for each metric to include

Attributes:
_metrics_by_namedict

Dictionary mapping metric names to MetricWrapper instances

_abbreviations_to_namedict

Dictionary mapping metric abbreviations to full names

get_metric(identifier: str) Callable#

Retrieve a metric function by name or abbreviation.

Parameters:
identifierstr

Full name or abbreviation of the metric

Returns:
callable

The metric function

Raises:
ValueError

If metric is not found

get_name(identifier: str) str#

Retrieve a metric’s display name.

Parameters:
identifierstr

Full name or abbreviation of the metric

Returns:
str

The formatted display name

Raises:
ValueError

If metric is not found

get_scorer(identifier: str) Callable#

Retrieve a scoring callable by name or abbreviation.

Parameters:
identifierstr

Full name or abbreviation of the metric

Returns:
callable

The scoring callable

Raises:
ValueError

If scoring callable is not found

list_metrics() List[str]#

Get list of available metric names.

Returns:
list of str

List of available metric names

set_split_metadata(split_metadata: Dict[str, Any]) None#

Set the split_metadata for all metrics.

Parameters:
split_metadatadict

Metadata to set for all metrics