-
Notifications
You must be signed in to change notification settings - Fork 0
/
hallway_plotting.py
52 lines (42 loc) · 1.31 KB
/
hallway_plotting.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
41
42
43
44
45
46
47
48
49
50
51
52
import numpy as np
import matplotlib.pyplot as plt
from sklearn import neighbors
import discrete
import utils.plotting
from utils.pickle import dump, load
from utils.plotting import cdf_points
def trajectory_plot(results):
N = len(results)
colors = iter(plt.cm.jet(np.linspace(0,1,N)))
handles = []
for ((name,scale),result) in results.items():
data = result.states[:,0,:]
color = next(colors)
h = plt.plot(data.T,c=color,lw=2,alpha=0.1,label=name)[0]
handles.append(h)
plt.legend(handles,results.keys(),loc='best')
plt.show()
def cdf_plot(returns):
for (name,ret) in returns.items():
(x,f) = cdf_points(ret)
plt.plot(x,f,'-',lw=2,label=name)[0]
plt.legend(returns.keys(),loc='best')
plt.show()
def compare(returns,a,*vargs):
x = returns[a]
for comp in vargs:
y = returns[comp]
plt.plot(x,y,'o',label=comp)
plt.xlabel(a)
plt.legend(loc='best')
plt.show()
root = 'data/exper2/hallway'
#results = load(root + '.results.pickle')
returns = load(root + '.return.pickle')
#states = load(root + '.starts.pickle')
#compare(returns,'q','q pert','mcts')
filtered_returns = {}
for (name,ret) in returns.items():
split_name = name.split('_')
filtered_returns[name] = ret
cdf_plot(filtered_returns)