#!/usr/bin/env python3 import collections import csv import glob import statistics # type-values-aggregation-model[-epochs] results = {} for filename in glob.glob('extend_*'): 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]) x[2] = int(x[2]) if len(x) > 4: x[4] = int(x[4]) 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:3]), '-'.join(it[3:]), end='') for j in range(len(results[i])): print('', statistics.mean(results[i][j]), statistics.stdev(results[i][j]), end='') print()