分类指标
- class ClassificationMetric[source]
-
分类指标的基础类。
属性摘要
指标是否需要二值化分数
是否存在期望的闭式解
是否存在方差的闭式解
返回用于度量结果字典的键。
指标是否支持权重
此指标的同义词
方法总结
__call__(y_true, y_score[, weights])评估指标。
生成额外的 repr,参见。
forward(y_true, y_score[, sample_weight])计算指标。
获取描述。
get_link()从docdata中获取链接。
获取此指标范围的数学表示。
遍历
extra_repr()的组件。属性文档
- key
返回用于度量结果字典的键。
方法文档
- __call__(y_true: ndarray, y_score: ndarray, weights: ndarray | None = None) float[来源]
评估指标。
- Parameters:
y_true (ndarray) – 形状: (num_samples,) 真实标签,值为0或1。
y_score (ndarray) – 形状: (num_samples,) 预测值,可以是连续的或二值化的。
weights (ndarray | None) –
形状: (num_samples,) 个体预测的权重
警告
并非所有指标都支持样本权重 - 请先检查
supports_weights
- Returns:
标量度量值
- Raises:
ValueError – 当提供了权重但函数不支持它们时。
- Return type:
- abstract forward(y_true: ndarray, y_score: ndarray, sample_weight: ndarray | None = None) float[source]
计算指标。
- Parameters:
- Returns:
一个标量度量值
- Return type:
# noqa:DAR202
- iter_extra_repr() Iterable[str]
遍历
extra_repr()的组件。此方法通常被重写。一个常见的模式是
def iter_extra_repr(self) -> Iterable[str]: yield from super().iter_extra_repr() yield "<key1>=<value1>" yield "<key2>=<value2>"
- Returns:
一个可迭代的单个组件,用于
extra_repr()- Return type: