-
Notifications
You must be signed in to change notification settings - Fork 0
/
weightviz.sage
48 lines (38 loc) · 884 Bytes
/
weightviz.sage
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
# vim: set filetype=python :
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import numpy
from numpy import array
import os
w = eval(file('offline_weights.txt').read())
from model import *
xs = []
yss = [[] for i in range(PER_TURN_FEATURES)]
my_silver = []
my_gold = []
for t in range(FINE_GRAIN_TURNS+1):
xs.append(t)
for i in range(PER_TURN_FEATURES):
yss[i].append(w[t*PER_TURN_FEATURES+i])
colours = [
(192, 192, 192),
(255, 215, 0),
(0, 192, 0),
(0, 128, 0),
(0, 64, 0),
(192, 192, 192),
(255, 215, 0),
(0, 192, 0),
(0, 128, 0),
(0, 64, 0),
(0,0,128),
]
styles = ['-']*5 + ['--']*5 + ['-']
def proc_colour(c):
r,g,b = c
return (r/255.0,g/255.0,b/255.0)
for i in range(PER_TURN_FEATURES):
plt.plot(xs,yss[i],styles[i],color=proc_colour(colours[i]))
plt.savefig('weightviz.png')
os.system('open weightviz.png')