maxframe.learn.metrics.auc#
- maxframe.learn.metrics.auc(x, y, execute=False, session=None, run_kwargs=None)[源代码]#
使用梯形法则计算曲线下面积 (AUC)
这是一个通用函数,给定曲线上的点。要计算 ROC 曲线下的面积,请参见
roc_auc_score()。要以另一种方式总结 precision-recall 曲线,请参见average_precision_score()。- 参数:
x (tensor, shape = [n]) -- x 坐标。这些值必须是单调递增或单调递减的。
y (tensor, shape = [n]) -- y 坐标。
- 返回:
auc
- 返回类型:
tensor, with float value
示例
>>> import maxframe.tensor as mt >>> from maxframe.learn import metrics >>> y = mt.array([1, 1, 2, 2]) >>> pred = mt.array([0.1, 0.4, 0.35, 0.8]) >>> fpr, tpr, thresholds = metrics.roc_curve(y, pred, pos_label=2) >>> metrics.auc(fpr, tpr).execute() 0.75
参见
roc_auc_score计算 ROC 曲线下的面积
average_precision_score根据预测得分计算平均精度
precision_recall_curve计算不同概率阈值下的 precision-recall 对