plot-plot
This commit is contained in:
parent
ef7d6eb04b
commit
150036a6cb
3
main.py
3
main.py
|
@ -1,5 +1,5 @@
|
||||||
import argparse
|
import argparse
|
||||||
import config
|
import sys
|
||||||
|
|
||||||
def print_train_outcome(outcome, init_ep = 0):
|
def print_train_outcome(outcome, init_ep = 0):
|
||||||
format_vars = { 'init_ep': init_ep,
|
format_vars = { 'init_ep': init_ep,
|
||||||
|
@ -67,6 +67,7 @@ if args.train:
|
||||||
eval_outcomes = g.eval(init_ep = eps)
|
eval_outcomes = g.eval(init_ep = eps)
|
||||||
print_eval_outcomes(eval_outcomes, init_ep = eps)
|
print_eval_outcomes(eval_outcomes, init_ep = eps)
|
||||||
eps += episode_count
|
eps += episode_count
|
||||||
|
sys.stdout.flush()
|
||||||
elif args.eval:
|
elif args.eval:
|
||||||
outcomes = g.eval()
|
outcomes = g.eval()
|
||||||
print_eval_outcomes(outcomes, init_ep = 0)
|
print_eval_outcomes(outcomes, init_ep = 0)
|
||||||
|
|
|
@ -3,7 +3,6 @@ from cup import Cup
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from board import Board
|
from board import Board
|
||||||
import os
|
import os
|
||||||
import config
|
|
||||||
|
|
||||||
class Network:
|
class Network:
|
||||||
hidden_size = 40
|
hidden_size = 40
|
||||||
|
|
26
plot.py
26
plot.py
|
@ -7,22 +7,28 @@ import matplotlib.ticker as mtick
|
||||||
import matplotlib.dates as mdates
|
import matplotlib.dates as mdates
|
||||||
from matplotlib.backends.backend_pdf import PdfPages
|
from matplotlib.backends.backend_pdf import PdfPages
|
||||||
headers = ['Phase', 'Method', 'Total episodes', 'Episodes', 'Sum', 'Mean']
|
headers = ['Phase', 'Method', 'Total episodes', 'Episodes', 'Sum', 'Mean']
|
||||||
df = pd.read_csv(sys.stdin, sep=";", names=headers)
|
|
||||||
|
|
||||||
print(df)
|
|
||||||
|
|
||||||
x = df['Total episodes']
|
|
||||||
y = df['Mean']
|
|
||||||
|
|
||||||
fig, ax = plt.subplots(1, 1)
|
fig, ax = plt.subplots(1, 1)
|
||||||
|
|
||||||
|
plt.ion()
|
||||||
plt.title('Mean over episodes')
|
plt.title('Mean over episodes')
|
||||||
plt.xlabel('Episodes')
|
plt.xlabel('Episodes')
|
||||||
plt.ylabel('Mean')
|
plt.ylabel('Mean')
|
||||||
plt.grid(True)
|
plt.grid(True)
|
||||||
|
|
||||||
plt.plot(x,y)
|
#ax.set_xlim(left=0)
|
||||||
|
ax.set_ylim([-2, 2])
|
||||||
|
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
pp = PdfPages(sys.argv[1])
|
while True:
|
||||||
pp.savefig()
|
#df = pd.read_csv(sys.stdin, sep=";", names=headers)
|
||||||
pp.close()
|
df = pd.read_csv('log', sep=";", names=headers)
|
||||||
|
|
||||||
|
x = df['Total episodes']
|
||||||
|
y = df['Mean']
|
||||||
|
|
||||||
|
plt.scatter(x, y, c=[[1,0.5,0]])
|
||||||
|
print("draw")
|
||||||
|
#fig.canvas.draw()
|
||||||
|
plt.pause(2)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user