深度学习模型评估指标(http://scikit-learn.org/stable/)

 

在机器学习中,对模型的测量和评估同样至关重要。只有选择与问题相匹配的评估方法,我们才能够快速的发现在模型选择和训练过程中可能出现的问题,迭代地对模型进行优化。

常见的模型评估指标:

precision

recall

F1-score

PRC

ROC/AUC

IOU

(1)Next,i will introduce confusion matrix:

TP+FN+FP+FN=the whole sample

 (2)PRC(Precision Recall Curve):[x:Recall,y:Precision]

(A>B>C) 

(3)

F1 is a metric that consider both precision and recall,better than BEP.

(4)ROC and AUC

a.ROC

X:FPR,Y:TPR

TPR means Recall,FPR means sample predicted positive from actual neg.

AUC:the aera under ROC.If the classifer is enough good,the AUC=1,the higher AUC,the better classifier.

How to choose the evaluating metric?

(5)IOU:

 

附:

(1)precision with python

fT=file(r'C:\\Users\\hp\\Desktop\\trainlabel.txt','r')
fP=file(r'C:\\Users\\hp\\Desktop\\predictlabel.txt','r')
    
fTLines = fT.readlines();
fPLines = fP.readlines();
train_label = [0 for x in range(len(fTLines))]
predict_label = [0 for x in range(len(fPLines))]

count = 0
for eachline in fTLines:
    eachline = eachline.strip('\n')
    train_label[count] = eachline
        count=count+1

count = 0
for eachline in fPLines:
    eachline = eachline.strip('\n')
        predict_label[count] = eachline
        count=count+1

from sklearn import metrics
p=metrics.precision_score(train_label,predict_label,pos_label='1')

(2)roc/auc with python

import numpy as np

from sklearn.metrics import roc_curve

y = np.array([1,1,2,2])

pred = np.array([0.1,0.4,0.35,0.8])

fpr, tpr, thresholds = roc_curve(y, pred, pos_label=2)

print(fpr)

print(tpr)

print(thresholds)

from sklearn.metrics import auc

print(auc(fpr, tpr))

(3)recall with python

from sklearn.metrics import recall_score

y_true = [0, 1, 2, 0, 1, 2]

y_pred = [0, 2, 1, 0, 0, 1]

recall_score(y_true, y_pred, average='macro')

0.33...

recall_score(y_true, y_pred, average='micro')

0.33...

recall_score(y_true, y_pred, average='weighted')

0.33...

recall_score(y_true, y_pred, average=None)

array([1., 0., 0.])

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值