-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfigures.py
33 lines (30 loc) · 909 Bytes
/
figures.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
#!/bin/env python
'''
generates figures used in the paper
'''
import matplotlib.pyplot as plt
import numpy as np
from os.path import join
import ipdb as pdb
def plot_val_loss(data_dir):
# single test
tmp = np.load(join(data_dir,'e2c-val-loss.npz'))
L_mean=tmp['mean'] # mean validation loss
L_std=tmp['std'] # std validation loss
T = range(L_mean.size)
plt.errorbar(T[::4], L_mean[::4], L_std[::4],label='validation loss')
L_train=np.load(join(data_dir,'l_hist.npy'))
B=100
plt.plot(range(2,L_mean.size),L_train[2*B::B],label='train loss') # minibatch length
plt.ylim([0,650])
plt.xlabel('Episode')
plt.legend()
return
if __name__ == '__main__':
# data needs to be generated by plane_analyze.py first
data_dir='/ltmp/e2c-plane2-adaptive'
#data_dir='/ltmp/e2c-plane2-rand/'
plot_val_loss(data_dir)
#plt.title('Random Policy')
#plt.savefig('rand_post.png')
plt.show()