forked from spragunr/deep_q_rl
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathplot_results.py
31 lines (25 loc) · 837 Bytes
/
plot_results.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
"""Plots data corresponding to Figure 2 in
Playing Atari with Deep Reinforcement Learning
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis
Antonoglou, Daan Wierstra, Martin Riedmiller
Usage:
plot_results.py RESULTS_CSV_FILE
"""
import numpy as np
import matplotlib.pyplot as plt
import sys
# Modify this to do some smoothing...
kernel = np.array([1.] * 1)
kernel = kernel / np.sum(kernel)
results = np.loadtxt(open(sys.argv[1], "rb"), delimiter=",", skiprows=1)
plt.subplot(1, 2, 1)
plt.plot(results[:, 0], np.convolve(results[:, 3], kernel, mode='same'), '-')
plt.xlabel('Training Epochs')
plt.ylabel('Average score per episode')
#plt.ylim([0, 250])
plt.subplot(1, 2, 2)
plt.plot(results[:, 0], results[:, 4], '-')
plt.xlabel('Training Epochs')
plt.ylabel('Average action value')
#plt.ylim([0, 4])
plt.show()