-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcount_wins.py
More file actions
34 lines (28 loc) · 886 Bytes
/
count_wins.py
File metadata and controls
34 lines (28 loc) · 886 Bytes
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
from __future__ import print_function
from collections import defaultdict
import json
import sys
def main():
results = json.load(sys.stdin)
anonymized = {
'broad': 'C',
'dkfz': 'F',
'jabba': 'E',
'mustonen095': 'D',
'peifer': 'A',
'vanloo_wedge_segs': 'B',
}
for K in ('most_bp', 'precision_winners', 'recall_winners', 'total_domination_winners'):
wins = defaultdict(int)
for comparison in results[K].values():
for meth, methwins in comparison.items():
wins[meth] += methwins
ranked = sorted(wins.items(), key = lambda (M, W): W, reverse = True)
# Anonymize and rank.
ranked = [(anonymized[M], W, idx + 1) for idx, (M, W) in enumerate(ranked)]
# Sort by name.
ranked = sorted(ranked, key = lambda (M, W, R): -W)
print(K)
print(*['%s\t%s\t%s' % T for T in ranked], sep='\n')
print('---')
main()