diff --git a/main.py b/main.py index e320595..eea36ed 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,5 @@ import argparse -import config +import sys def print_train_outcome(outcome, init_ep = 0): format_vars = { 'init_ep': init_ep, @@ -67,6 +67,7 @@ if args.train: eval_outcomes = g.eval(init_ep = eps) print_eval_outcomes(eval_outcomes, init_ep = eps) eps += episode_count + sys.stdout.flush() elif args.eval: outcomes = g.eval() print_eval_outcomes(outcomes, init_ep = 0) diff --git a/network.py b/network.py index 007b213..cdb3510 100644 --- a/network.py +++ b/network.py @@ -3,7 +3,6 @@ from cup import Cup import numpy as np from board import Board import os -import config class Network: hidden_size = 40 diff --git a/plot.py b/plot.py index ed81069..f0eefbb 100644 --- a/plot.py +++ b/plot.py @@ -7,22 +7,28 @@ import matplotlib.ticker as mtick import matplotlib.dates as mdates from matplotlib.backends.backend_pdf import PdfPages 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) + +plt.ion() plt.title('Mean over episodes') plt.xlabel('Episodes') plt.ylabel('Mean') plt.grid(True) -plt.plot(x,y) +#ax.set_xlim(left=0) +ax.set_ylim([-2, 2]) + plt.show() -pp = PdfPages(sys.argv[1]) -pp.savefig() -pp.close() +while True: + #df = pd.read_csv(sys.stdin, sep=";", names=headers) + 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)