指标结果

class MetricResults(data: Mapping[MetricKeyType | str, float])[source]

基础类: Generic[MetricKeyType]

计算指标的结果。

初始化结果包装器。

方法总结

get_metric(name)

从结果中获取给定的指标。

key_from_string(s)

从(未标准化的)字符串中解析度量键。

key_to_string(s)

将键转换为规范化键。

string_or_key_to_key(s)

将键转换为命名元组。

to_df()

将指标输出为pandas数据框。

to_dict()

提取一个(可能是嵌套的)与JSON兼容的字典。

to_flat_dict()

获取结果作为一个扁平化的字典。

方法文档

Parameters:

数据 (映射[MetricKeyType, 浮点数])

get_metric(name: str | MetricKeyType) float[source]

从结果中获取给定的指标。

Parameters:

name (str | MetricKeyType) – 指标的名称

Returns:

指标的值

Return type:

float

abstract classmethod key_from_string(s: str | None) MetricKeyType[来源]

从(未标准化的)字符串中解析度量键。

Parameters:

s (str | None) – 指标键,或 None 以获取默认键。

Returns:

完全解析的键作为一个命名元组

Return type:

MetricKeyType

classmethod key_to_string(s: str | MetricKeyType | None) str[来源]

将键转换为规范化键。

Parameters:

s (str | MetricKeyType | None)

Return type:

str

classmethod string_or_key_to_key(s: str | MetricKeyType | None) MetricKeyType[来源]

将键转换为命名元组。

Parameters:

s (str | MetricKeyType | None)

Return type:

MetricKeyType

to_df() DataFrame[source]

将指标输出为pandas数据框。

Return type:

数据框

to_dict() Mapping[str, Any][来源]

提取一个(可能是嵌套的)与JSON兼容的字典。

Return type:

Mapping[str, Any]

to_flat_dict() Mapping[str, Any][来源]

获取结果作为一个扁平化的字典。

Return type:

Mapping[str, Any]