forked from Kingsford-Group/kbf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanalyse.py
32 lines (26 loc) · 835 Bytes
/
analyse.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
# don't mind me, I'm a quick and dirty python script
# I extract false positive rate from the output files of kbf
def lire(filemane):
TP, TN, FP, FN = 0, 0, 0, 0
with open(filemane, "r") as fichier:
for ligne in fichier:
cols = ligne.split()
if cols[1] == "0":
if cols[2] == "0":
TN += 1
else:
FN += 1
else:
if cols[2] == "0":
FP += 1
else:
TP += 1
return TP, TN, FP, FN
def analyser(filename):
TP, TN, FP, FN = lire(filename)
# print(TP, TN, FP, FN)
return filename, (FP / (FP + TN)) * 100
def main():
print(analyser("test_classic.txt"))
print(analyser("test_kbf1.txt"))
print(analyser("test_kbf2.txt"))