-
Notifications
You must be signed in to change notification settings - Fork 0
/
check.py
77 lines (55 loc) · 1.94 KB
/
check.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import pickle
import matplotlib.pyplot as plt
from statistics import median, mean
with open('final_score', 'rb') as f:
score = pickle.load(f)
with open('final_score_segmentation', 'rb') as f:
score_segmentation = pickle.load(f)
with open('supervised_loss', 'rb') as f:
loss = pickle.load(f)
plt.figure()
plt.title('Supervised Loss')
plt.plot(loss)
plt.savefig('save/supervised', dpi=300)
plt.show()
with open('test_score', 'rb') as f:
test_score = pickle.load(f)
# test_score['policy'] = test_score['policy'][:10]
print(mean(test_score['policy']))
print(mean(test_score['random']))
plt.figure()
plt.title('Final Score')
plt.plot(test_score['policy'], label = 'Trained Model')
plt.plot(test_score['random'], label = 'Random Policy')
plt.legend()
plt.savefig('save/test', dpi=300)
plt.show()
# score_avg_100 = list()
# for i in range(len(score)-100):
# score_avg_100.append(sum(score[i:i+100])/100)
# score_avg_1000 = list()
# xlabel = range(900,len(score)-100)
# for i in range(len(score)-1000):
# score_avg_1000.append(sum(score[i:i+1000])/1000)
# plt.figure()
# plt.title("Final Score")
# plt.plot(score_avg_100, label = 'Rolling Window = 100')
# plt.plot(xlabel, score_avg_1000, label = 'Rolling Window = 1000')
# plt.legend()
# plt.savefig('save/score', dpi=300)
# plt.show()
score_avg_100_segmentation = list()
for i in range(len(score_segmentation)-100):
score_avg_100_segmentation.append(sum(score_segmentation[i:i+100])/100)
score_avg_1000_segmentation = list()
xlabel = range(900,len(score_segmentation)-100)
for i in range(len(score_segmentation)-1000):
score_avg_1000_segmentation.append(sum(score_segmentation[i:i+1000])/1000)
plt.figure()
plt.title("Final Score")
#plt.plot(score_segmentation)
plt.plot(score_avg_100_segmentation, label = 'Rolling Window = 100')
plt.plot(xlabel, score_avg_1000_segmentation, label = 'Rolling Window = 1000')
plt.legend()
plt.savefig('save/score_segmentation', dpi=300)
plt.show()