MetricResults
- class MetricResults(data: Mapping[MetricKeyType | str, float])[source]
Bases:
Generic
[MetricKeyType
]Results from computing metrics.
Initialize the result wrapper.
Methods Summary
get_metric
(name)Get the given metric from the results.
Parse the metric key from a (un-normalized) string.
Convert a key to a normalized key.
Convert a key to a named tuple.
to_df
()Output the metrics as a pandas dataframe.
to_dict
()Extract a (potentially nested) JSON-compatible dictionary.
Get the results as a flattened dictionary.
Methods Documentation
- abstract classmethod key_from_string(s: str | None) MetricKeyType [source]
Parse the metric key from a (un-normalized) string.
- Parameters:
s (str | None) – the metric key, or None to get the default key.
- Returns:
the fully resolved key as a named tuple
- Return type:
MetricKeyType
- classmethod key_to_string(s: str | MetricKeyType | None) str [source]
Convert a key to a normalized key.
- classmethod string_or_key_to_key(s: str | MetricKeyType | None) MetricKeyType [source]
Convert a key to a named tuple.
- Parameters:
s (str | MetricKeyType | None)
- Return type:
MetricKeyType