-
Notifications
You must be signed in to change notification settings - Fork 26
/
gen_gul_tbl.py
42 lines (34 loc) · 1.22 KB
/
gen_gul_tbl.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
import sys
from collections import *
files=[("base","results/gulordava_results_base.txt"),("large","results/gulordava_results_large.txt")]
by_model={}
conditions=set()
nskipped=0
for title,fname in files:
lines = open(fname)
results=defaultdict(Counter)
by_model[title]=results
skipped = set()
for line in lines:
if line.startswith("Better speed"): continue
if line.startswith("skipping"):
skipped.add(line.split()[1])
#next(lines) # no need to skip, skipped in testing
nskipped += 1
continue
assert (line.strip().split()[0] in ['True','False']),line
res,c1,_ = line.split(None, 2)
conditions.add(c1)
conditions.add('all')
results[c1][res]+=1
print("adding",res,"to",c1)
results['all'][res]+=1
print("skipped:",nskipped,len(skipped),skipped)
print("condition & base & large & count \\\\")
for cond in conditions:
rb = by_model['base'][cond]
rl = by_model['large'][cond]
if sum(rb.values())==0: continue
sb = "%.2f" % (rb['True']/(rb['True']+rb['False']))
sl = "%.2f" % (rl['True']/(rl['True']+rl['False']))
print(" & ".join(map(str,[cond, sb, sl, sum(rb.values())])),"\\\\")