Created
February 26, 2016 08:44
-
-
Save choupi/93218424d192e8a91369 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import csv | |
import math | |
from sklearn import metrics | |
EPS=1e-15 | |
rd=[] | |
y=[] | |
with open(sys.argv[1], 'rb') as f: | |
for sl in csv.reader(f): | |
if len(sl)<4: continue | |
rd.append(float(sl[2])) | |
y.append(int(sl[3])) | |
fpr, tpr, thresholds = metrics.roc_curve(y, rd) | |
#print fpr | |
#print tpr | |
#print thresholds | |
print metrics.auc(fpr, tpr) | |
with open(sys.argv[2], 'wb') as f: | |
f.write('0 0\n') | |
for i in xrange(len(fpr)): | |
f.write('%.8f %.8f\n'%(fpr[i], tpr[i])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment