mindspore/docs/api/api_python/train/mindspore.train.Fbeta.rst

43 lines
1.5 KiB
ReStructuredText
Raw Permalink Normal View History

mindspore.train.Fbeta
======================
2021-12-04 13:55:42 +08:00
.. py:class:: mindspore.train.Fbeta(beta)
2021-12-04 13:55:42 +08:00
2021-12-31 16:45:06 +08:00
计算Fbeta评分。
2021-12-04 13:55:42 +08:00
Fbeta评分是精度(Precision)和召回率(Recall)的加权平均值。
.. math::
F_\beta=\frac{(1+\beta^2) \cdot true\_positive}
{(1+\beta^2) \cdot true\_positive +\beta^2 \cdot false\_negative + false\_positive}
2022-07-22 16:25:38 +08:00
参数:
- **beta** (Union[float, int]) - F-measure中的beta系数 。
2021-12-04 13:55:42 +08:00
.. py:method:: clear()
内部评估结果清零。
2022-03-10 17:48:35 +08:00
.. py:method:: eval(average=False)
2021-12-04 13:55:42 +08:00
计算fbeta结果。
2022-07-22 16:25:38 +08:00
参数:
- **average** (bool) - 是否计算fbeta平均值。默认值False。
2021-12-04 13:55:42 +08:00
2022-07-22 16:25:38 +08:00
返回:
numpy.ndarray或numpy.float64计算的Fbeta score结果。
2021-12-04 13:55:42 +08:00
.. py:method:: update(*inputs)
使用预测值 `y_pred` 和真实标签 `y` 更新内部评估结果。
2022-07-22 16:25:38 +08:00
参数:
- **inputs** - `y_pred``y``y_pred``y` 支持Tensor、list或numpy.ndarray类型。
通常情况下, `y_pred` 是0到1之间的浮点数列表shape为 :math:`(N, C)` ,其中 :math:`N` 是样本数, :math:`C` 是类别数。
`y` 是整数值如果使用one-hot编码则shape为 :math:`(N,C)` 如果使用类别索引shape是 :math:`(N,)`
2021-12-31 16:45:06 +08:00
2022-07-22 16:25:38 +08:00
异常:
- **ValueError** - 当前输入的 `y_pred` 和历史 `y_pred` 类别数不匹配。
- **ValueError** - 预测值和真实值包含的类别不同。