mindspore.train.Fbeta
- class mindspore.train.Fbeta(beta)[源代码]
计算Fbeta评分。
Fbeta评分是精度(Precision)和召回率(Recall)的加权平均值。
- 参数:
beta (Union[float, int]) - F-measure中的beta系数。
- 支持平台:
Ascend
GPU
CPU
样例:
>>> import numpy as np >>> from mindspore import Tensor >>> from mindspore.train import Fbeta >>> >>> x = Tensor(np.array([[0.2, 0.5], [0.3, 0.1], [0.9, 0.6]])) >>> y = Tensor(np.array([1, 0, 1])) >>> metric = Fbeta(1) >>> metric.clear() >>> metric.update(x, y) >>> fbeta = metric.eval() >>> print(fbeta) [0.66666667 0.66666667]