-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgraph.py
36 lines (30 loc) · 946 Bytes
/
graph.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
#!/usr/bin/env python
"""
plot graph of training
"""
import csv
import matplotlib.pyplot as plt
def read_file(name):
'return list of win, lose draw over time'
win, lose, draw = [], [], []
with open(name) as csvfile:
reader = csv.reader(csvfile)
for row in reader:
win.append(float(row[0]))
lose.append(float(row[1]))
draw.append(float(row[2]))
return win, lose, draw
def make_graph(win, lose, draw, limit, batch):
'plot graph'
x = range(0, batch*limit, batch)
plt.plot(x, win[:limit], label="P(win)")
plt.plot(x, draw[:limit], label="P(draw)")
plt.plot(x, lose[:limit], label="P(lose)")
plt.legend()
plt.title("Training vs Time")
plt.xlabel('Self-Play Games Played')
plt.ylabel('Probability')
plt.show()
if __name__ == "__main__":
win, lose, draw = read_file("tDLambda_9_128_32_1.csv")
make_graph(win, lose, draw, 1000, 20)