-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplotter-for-performance.py
40 lines (33 loc) · 1.33 KB
/
plotter-for-performance.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
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn
data = np.loadtxt('./reward_vs_iteration.dat')
df = pd.DataFrame(data, columns=['training', 'performance', 'steps'])
df.loc[:, 'inverse-performance'] = 1.0/df.loc[:, 'performance']
df.loc[:, 'mistaken-steps'] = df.loc[:, 'steps'] - df.loc[:, 'performance'] * df.loc[:, 'steps']
averaged_50 = df.rolling(128).mean().dropna(axis=0)
fig, ax = plt.subplots()
ax.set(yscale='log', xscale='linear')
ax.set(xlabel='training', ylabel='inverse-performance')
seaborn.lineplot(x='training', y='inverse-performance', data=df, ax=ax)
seaborn.lineplot(x='training', y='inverse-performance', data=averaged_50, ax=ax)
#plt.show()
plt.savefig('inverse-performance-vs-training')
plt.clf()
fig, ax = plt.subplots()
ax.set(yscale='linear', xscale='linear')
ax.set(xlabel='training', ylabel='performance')
seaborn.lineplot(x='training', y='performance', data=df)
seaborn.lineplot(x='training', y='performance', data=averaged_50)
#plt.show()
plt.savefig('performance-vs-training')
plt.clf()
fig, ax = plt.subplots()
ax.set(yscale='linear', xscale='linear')
ax.set(xlabel='training', ylabel='mistaken-steps')
seaborn.lineplot(x='training', y='mistaken-steps', data=df)
seaborn.lineplot(x='training', y='mistaken-steps', data=averaged_50)
#plt.show()
plt.savefig('mistaken-vs-training')
plt.clf()