实际
1 0
预测 1 760 290
0 1937 12488
其中预测为正例 1050,预测为负例14425
我们很容易得到 上面的 0正确率为12488/14425 召回为12488/12778
1的正确率为 760/1050 召回为760/2697
结果跟上面的结果一致,可是下面的avg/total 怎么来的,百思不得其解
查到
http://stackoverflow.com/questions/31169874/what-does-the-last-raw-mean-in-classification-report-in-scikit-learn
http://scikit-learn.org/stable/modules/generated/sklearn.metrics.precision_recall_fscore_support.html
http://stats.stackexchange.com/questions/117654/what-does-the-numbers-in-the-classification-report-of-sklearn-mean
源码如下:
# compute averages
values = [last_line_heading]
for v in (np.average(p, weights=s),
np.average(r, weights=s),
np.average(f1, weights=s)):
values += ["{0:0.{1}f}".format(v, digits)]
values += ['{0}'.format(np.sum(s))]
原来是加权平均出来的
like this
准确率 =(0.87*12778+0.72*2697)/(12778+2697)
召回率 =(0.98*12778+0.28*2697)/(12778+2697)
也是醉了
No comments:
Post a Comment