-
Notifications
You must be signed in to change notification settings - Fork 0
/
helper.py
45 lines (38 loc) · 1.08 KB
/
helper.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
import matplotlib.pyplot as plt
from IPython import display
import pandas as pd
import os
plt.ion()
def plot(scores, mean_scores):
display.clear_output(wait=True)
display.display(plt.gcf())
plt.clf()
plt.title('Training...')
plt.xlabel('Number of Games')
plt.ylabel('Score')
plt.plot(scores, label='Score')
plt.plot(mean_scores, label='Mean Score')
plt.ylim(ymin=0)
plt.text(len(scores)-1, scores[-1], str(scores[-1]))
plt.text(len(mean_scores)-1, mean_scores[-1], str(mean_scores[-1]))
plt.legend()
plt.show(block=False)
plt.pause(.1)
plt.savefig('score with epsilon of 450')
def unpack_tuple_list(tuple_list):
res = []
for element in tuple_list:
if type(element) == tuple:
temp1 = element[0]
temp2 = element[1]
res.append(temp1)
res.append(temp2)
else:
res.append(element)
return res
def add_flatten_lists(the_lists):
result = []
for _list in the_lists:
result += _list
result = unpack_tuple_list(result)
return result