In [15]:
using JLD
push!(LOAD_PATH,joinpath("..","src"))
using Multilane

In [16]:
d = load("results.jld")


LoadError: stored type Multilane.NoCrashStat does not match currently loaded type
while loading In[16], in expression starting on line 1

 in jldatatype at /home/zach/.julia/JLD/src/jld_types.jl:699
 in read at /home/zach/.julia/JLD/src/JLD.jl:381
 in read_ref at /home/zach/.julia/JLD/src/JLD.jl:509
 in read_refs at /home/zach/.julia/JLD/src/JLD.jl:482
 in read_array at /home/zach/.julia/JLD/src/JLD.jl:418
 in read at /home/zach/.julia/JLD/src/JLD.jl:383
 in read_ref at /home/zach/.julia/JLD/src/JLD.jl:509
 [inlined code] from /home/zach/.julia/JLD/src/jld_types.jl:430
 in jlconvert at /home/zach/.julia/JLD/src/jld_types.jl:439
 in read_scalar at /home/zach/.julia/JLD/src/JLD.jl:409
 in read at /home/zach/.julia/JLD/src/JLD.jl:381
 in read at /home/zach/.julia/JLD/src/JLD.jl:357
 in anonymous at /home/zach/.julia/JLD/src/JLD.jl:1212
 in jldopen at /home/zach/.julia/JLD/src/JLD.jl:256
 in load at /home/zach/.julia/JLD/src/JLD.jl:1211
 in load at /home/zach/.julia/FileIO/src/loadsave.jl:42

In [14]:
import Base: mean, std
function mean(ncs::NoCrashStats)
  t = Real[stat.t_in_goal for stat in ncs.stats]
  b = Real[stat.nb_induced_brakes for stat in ncs.stats]
  r = Real[stat.reward for stat in ncs.stats]
  return mean(t), mean(b), mean(r)
end

function std(ncs::NoCrashStats)
  t = Real[stat.t_in_goal for stat in ncs.stats]
  b = Real[stat.nb_induced_brakes for stat in ncs.stats]
  r = Real[stat.reward for stat in ncs.stats]
  return std(t), std(b), std(r)
end

function ste(ncs::NoCrashStats)
  t,b,r = std(ncs)
  return t/sqrt(length(ncs)), b/sqrt(length(ncs)), r/sqrt(length(ncs))
end


Out[14]:
ste (generic function with 1 method)

In [5]:
dpw = [string("dpw",k) for k in 1:10]
single_dpw = [string("single_dpw",k) for k in 1:10]


Out[5]:
10-element Array{ByteString,1}:
 "single_dpw1" 
 "single_dpw2" 
 "single_dpw3" 
 "single_dpw4" 
 "single_dpw5" 
 "single_dpw6" 
 "single_dpw7" 
 "single_dpw8" 
 "single_dpw9" 
 "single_dpw10"

In [6]:
using PyPlot

In [7]:
random = mean(d["random"])


LoadError: UndefVarError: d not defined
while loading In[7], in expression starting on line 1

In [8]:
heur = mean(d["simple_heuristic"])
dpw = [mean(d[s]) for s in dpw]
single_dpw = [mean(d[s]) for s in single_dpw]


LoadError: UndefVarError: d not defined
while loading In[8], in expression starting on line 1

In [9]:
dpw_x = [x[1] for x in dpw]
dpy_y = [x[2] for x in dpw]
single_dpw_x = [x[1] for x in single_dpw]
single_dpw_y = [x[2] for x in single_dpw]
pomcp_dpw_x = [0,7,16.5,7.6,9.1,8.1,1.2,0.1,0.3,0.6]
pomcp_dpw_y = [0.3,6.933, 8.8,11, 8.133, 7.62, 5.21, 6.2033, 4.204, 6.501]
pomcp_dpw_x_2 = [0, 11.3, 9.6, 7.1, 1.1, 0.8, 7.3, 3.1, 0.8, 0.1]
pomcp_dpw_y_2 = [0.3, 12.6667, 9, 11.9, 9.7333, 2.54, 9.80999,5.0066, 10.5, 5.801]


Out[9]:
10-element Array{Float64,1}:
  0.3    
 12.6667 
  9.0    
 11.9    
  9.7333 
  2.54   
  9.80999
  5.0066 
 10.5    
  5.801  

In [11]:
plot(dpw_x,dpy_y)
plot(single_dpw_x,single_dpw_y)
plot(random[1],random[2],"x")
plot(heur[1],heur[2],"x")
plot(pomcp_dpw_x,pomcp_dpw_y)
#plot(pomcp_dpw_x_2,pomcp_dpw_y_2)
#legend(["DPW","Single DPW", "random", "heur"],"upper left")
legend(["DPW","Single DPW", "random", "heur","pomcp","pomcp2"],loc="upper left")
xlabel("time in desired lane")
ylabel("nb dangerous brakes")


LoadError: PyError (:PyObject_Call) <type 'exceptions.TypeError'>
TypeError('float() argument must be a string or a number',)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 2987, in plot
    ret = ax.plot(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/axes.py", line 4138, in plot
    self.add_line(line)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/axes.py", line 1497, in add_line
    self._update_line_limits(line)
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/axes.py", line 1508, in _update_line_limits
    path = line.get_path()
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/lines.py", line 743, in get_path
    self.recache()
  File "/usr/local/lib/python2.7/dist-packages/matplotlib/lines.py", line 420, in recache
    x = np.asarray(xconv, np.float_)
  File "/usr/local/lib/python2.7/dist-packages/numpy/core/numeric.py", line 460, in asarray
    return array(a, dtype, copy=False, order=order)

while loading In[11], in expression starting on line 1

 [inlined code] from /home/zach/.julia/PyCall/src/exception.jl:81
 in pycall at /home/zach/.julia/PyCall/src/PyCall.jl:463
 in plot at /home/zach/.julia/PyPlot/src/PyPlot.jl:460

In [11]:
length(pomcp_dpw_y)


Out[11]:
10

In [ ]: