-
Notifications
You must be signed in to change notification settings - Fork 0
/
calc_logauc.py
46 lines (37 loc) · 765 Bytes
/
calc_logauc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/python
import sys, os
import numpy as np
from math import log10, log
from scipy.integrate import trapz
from numpy import trapz
#DB = sys.argv[1]
f = open("enr1000.dud","r")
malistey = []
malistex = []
malistex2 = []
lines = f.readlines()
#print lines
for i in lines:
# print i
splited=i.split()
xla=float(splited[0])
xla2=float(splited[0])/1000
#print xla, xla2
if float(xla) < 0.01:
xl1=log10(0.01)
#pass
else:
xl1=log10(xla)
#print xl1
#print xla, xla2, xl1
xl2=xl1/3
#print xl2
yla=float(splited[1])
#print yla
malistey.append(yla)
malistex.append(xl2)
malistex2.append(xla2)
area=trapz(malistey,malistex)
area2=trapz(malistey,malistex2)
print "AUC= %.3f logAUC= %.3f" % (area2,area)
f.close()