#!/usr/bin/env python3
|
|
import collections
|
import csv
|
import glob
|
import statistics
|
|
# type-aggregation-model[-epochs]
|
|
results = {}
|
|
for filename in glob.glob('aggregation_*'):
|
with open(filename) as fp:
|
reader = csv.reader(fp, delimiter=' ')
|
for row in reader:
|
assert row[0] == 'RESULT'
|
|
if row[1] not in results:
|
results[row[1]] = [ [], [], [] ]
|
|
for i in range(3):
|
results[row[1]][i].append(float(row[2+i]))
|
|
def key_fix(x):
|
x = x[0].split('_')
|
|
x[0] = {'past':0, 'flow': 1, 'fore':2, 'all':3}[x[0]]
|
x[1] = int(x[1])
|
if len(x) > 3:
|
x[3] = int(x[3])
|
return x
|
|
results = collections.OrderedDict(sorted(results.items(), key=key_fix))
|
|
last = None
|
for i in results:
|
it = i.split('_')
|
if it[0] != last:
|
print()
|
last = it[0]
|
print('-'.join(it[0:2]), '-'.join(it[2:]), end='')
|
for j in range(len(results[i])):
|
print('', statistics.mean(results[i][j]), statistics.stdev(results[i][j]), end='')
|
print()
|