-
Notifications
You must be signed in to change notification settings - Fork 0
/
min_results.py
executable file
·59 lines (40 loc) · 1.19 KB
/
min_results.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env python
from itertools import *
import cPickle as pickle
import datetime
from pprint import pprint
import mathtest
import numpy
import gzip
fname = 'log.pkl.gz'
date_ix = 4
test_name_ix = 0
keyfunc = lambda l: l[test_name_ix]
keyfunc2 = lambda x: x[4].timetuple()[:5]
log = pickle.load(gzip.open(fname, 'rb'))
last_test = None
print
print ' test n av score sc trend sc y-int av time time trend time y-int'
sums = [0] + ([0.0] * 6)
for test, g in groupby(sorted(log, key=keyfunc), key=keyfunc):
if test not in mathtest.possible_tests:
continue
g = list(g)
n = len(g)
x = range(n)
y = [float(y[2]) for y in g]
m, b = numpy.polyfit(x, y, 1)
a = sum(y) / n
y2 = [y2[3] for y2 in g]
m2, b2 = numpy.polyfit(x, y2, 1)
a2 = sum(y2) / n
sums[0] += 1
sums[1] += a
sums[2] += m
sums[3] += b
sums[4] += a2
sums[5] += m2
sums[6] += b2
print "%10s %4i %4f % 5f %5f %07.4f % 5f %#08.5f" % (test, n, a, m, b, a2, m2, b2)
print "%10s %4i %4f % 5f %5f %07.4f % 5f %#08.5f" % ('(avg)', sums[0], sums[1]/sums[0], sums[2]/sums[0], sums[3]/sums[0], sums[4]/sums[0], sums[5]/sums[0], sums[6]/sums[0])
print