commit | author | age
|
425bf7
|
1 |
#!/usr/bin/env python3 |
JK |
2 |
|
|
3 |
import collections |
|
4 |
import csv |
|
5 |
import glob |
|
6 |
import statistics |
|
7 |
|
|
8 |
# type-values-aggregation-model[-epochs] |
|
9 |
|
|
10 |
results = {} |
|
11 |
|
|
12 |
for filename in glob.glob('extend_*'): |
|
13 |
with open(filename) as fp: |
|
14 |
reader = csv.reader(fp, delimiter=' ') |
|
15 |
for row in reader: |
|
16 |
assert row[0] == 'RESULT' |
|
17 |
|
|
18 |
if row[1] not in results: |
|
19 |
results[row[1]] = [ [], [], [] ] |
|
20 |
|
|
21 |
for i in range(3): |
|
22 |
results[row[1]][i].append(float(row[2+i])) |
|
23 |
|
|
24 |
def key_fix(x): |
|
25 |
x = x[0].split('_') |
|
26 |
|
|
27 |
x[0] = {'past':0, 'flow': 1, 'fore':2, 'all':3}[x[0]] |
|
28 |
x[1] = int(x[1]) |
|
29 |
x[2] = int(x[2]) |
|
30 |
if len(x) > 4: |
|
31 |
x[4] = int(x[4]) |
|
32 |
return x |
|
33 |
|
|
34 |
results = collections.OrderedDict(sorted(results.items(), key=key_fix)) |
|
35 |
|
|
36 |
last = None |
|
37 |
for i in results: |
|
38 |
it = i.split('_') |
|
39 |
if it[0] != last: |
|
40 |
print() |
|
41 |
last = it[0] |
|
42 |
print('-'.join(it[0:3]), '-'.join(it[3:]), end='') |
|
43 |
for j in range(len(results[i])): |
|
44 |
print('', statistics.mean(results[i][j]), statistics.stdev(results[i][j]), end='') |
|
45 |
print() |