你好,我想通过使用以下数据绘制召回率-精确度曲线:
Recall Precision
0.88196 0.467257
0.898501 0.468447
0.89899 0.470659
0.900789 0.471653
0.900922 0.472038
0.901012 0.472359
0.901345 0.480144
0.901695 0.482353
0.902825 0.482717
0.903261 0.483125
0.905152 0.483621
0.905575 0.485088
0.905682 0.486339
0.906109 0.488117
0.906466 0.488459
0.90724 0.488587
0.908989 0.488875
0.909941 0.489362
0.910125 0.489493
0.910314 0.490196
0.910989 0.49022
0.91106 0.490786
0.911137 0.496624
0.91129 0.496891
0.911392 0.497301
0.911392 0.499379
0.911422 0.5
0.911452 0.503783
0.911525 0.515829
源代码:
import random
import pylab as pl
from sklearn import svm, datasets
from sklearn.metrics import precision_recall_curve
from sklearn.metrics import auc
##Load Recall
fname = "recall.txt"
fname1 = "precision.txt"
recall = []
precision = []
with open(fname) as inf:
for line in inf:
recall.append(float(line))
with open(fname1) as inf:
for line in inf:
precision.append(float(line))
area = auc(recall, precision)
print("Area Under Curve: %0.2f" % area)
pl.clf()
pl.plot(recall, precision, label='Precision-Recall curve')
pl.xlabel('Recall')
pl.ylabel('Precision')
pl.ylim([0.0, 1.05])
pl.xlim([0.0, 1.0])
pl.title('Precision-Recall example: AUC=%0.2f' % area)
pl.legend(loc="lower left")
pl.show()
我得到的AUC = 0.01的面积正常吗?