forked from ad-freiburg/qlever
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompare_shuffled.py
41 lines (37 loc) · 1.13 KB
/
compare_shuffled.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
import sys
q_to_time = {}
i = 0
for line in open(sys.argv[1]):
try:
line = line.strip()
cols = line.split('\t')
q_to_time[cols[0]] = [(int(cols[2].split(' ')[0]), i)]
i += 1
except ValueError:
continue
i = 0
for line in open(sys.argv[2]):
try:
line = line.strip()
cols = line.split('\t')
q_to_time[cols[0]].append((int(cols[2].split(' ')[0]), i))
i += 1
except KeyError:
continue
except ValueError:
continue
for k,v in q_to_time.items():
if v[0][0] < v[1][0]:
smaller = float(v[0][0])
larger = float(v[1][0])
else:
smaller = float(v[1][0])
larger = float(v[0][0])
try:
if (larger / smaller > 2):
print('SIGNIFICANT DIFFERENCE: ' + k + ': (' + str(v[0][0]) + ', ' +
str(v[0][1]) + ') vs (' + str(v[1][0]) + ', ' + str(v[1][1])
+ ').')
print(' -> FACTOR: ' + str(larger / smaller))
except:
print('problem with : ' + k + ' ' + str(larger) + ' ' + str(smaller))