sklearn--召回率-精确率-auc

# -*- coding:utf-8 -*-

from sklearn import metrics


def recall_precision(true_y, pred_y):
    recall = metrics.recall_score(true_y, pred_y)
    precision = metrics.precision_score(true_y, pred_y)
    return recall, precision


def auc_score(true_y, pred_score, label_value=1):
    f, t, _ = metrics.roc_curve(true_y, pred_score, pos_label=label_value)
    return metrics.auc(f, t)

 

上一篇:一份完整的阿里云 Redis 开发规范,值得收藏!


下一篇:对解析几何中椭圆的基本认识