JuliaPOMDP / ParticleFilters.jl

@@ -29,7 +29,7 @@
Loading
29 29
	B = [0. 0.;
30 30
	     0. 0.]
31 31
32 -
	meas_noise = 2.0 # Measurment noise variance
32 +
	meas_noise = 5.0 # Measurment noise variance
33 33
	f(x,u,rng) = (Matrix(1.0*Diagonal(I,2)) + dt*A)*x
34 34
	h(x, rng) = rand(rng, Normal(x[1], meas_noise)) #Generates an observation
35 35
	g(x0, u, x, y) = pdf(Normal(x[1], meas_noise), y) #Creates likelihood
@@ -49,12 +49,17 @@
Loading
49 49
50 50
		# Set up for particle filter and cem filter
51 51
	model = ParticleFilterModel{Vector{Float64}}(f, g)
52 -
	N = 50 # Number of particles (10 causes posDef exception to throw up)
52 +
	N = 200 # Number of particles (10 causes posDef exception to throw up)
53 53
54 54
	filter_sir = SIRParticleFilter(model, N) # Vanilla particle filter
55 55
	filter_cem = CEMParticleFilter(model, N) # CEM filter
56 56
57 -
	b_sir = ParticleCollection([rand(2) for i in 1:N]) # Each particle is 2 element array
57 +
58 +
		# XXX Create initial particle set
59 +
		# Looked like the inbuilt rand only sampled from a Gaussian with spread 1
60 +
		# We need to start with more particle diversity
61 +
	init_dist = Normal(0,5)
62 +
	b_sir = ParticleCollection([rand(init_dist,2) for i in 1:N]) # Each particle is 2 element array
58 63
	b_cem = b_sir
59 64
60 65
		# Run iterations
@@ -88,7 +93,7 @@
Loading
88 93
"""
89 94
function make_gif(plots,filename)
90 95
	print("\n video name = $(filename)\n")
91 -
	frames = Frames(MIME("image/png"), fps=5)
96 +
	frames = Frames(MIME("image/png"), fps=10)
92 97
	for plt in plots
93 98
	    push!(frames, plt)
94 99
	end

@@ -155,7 +155,9 @@
Loading
155 155
	filter_sir = SIRParticleFilter(model, N) # Vanilla particle filter
156 156
	filter_cem = CEMParticleFilter(model, N) # CEM filter
157 157
158 -
	b = ParticleCollection([4.0*rand(4).-2.0 for i in 1:N])
158 +
		# XXX Initial sampling distribution
159 +
	init_dist = Normal(0,5)
160 +
	b = ParticleCollection([4.0*rand(init_dist,4).-2.0 for i in 1:N])
159 161
	b_cem = b
160 162
	
161 163
		# XXX: Printing particles
@@ -254,19 +256,19 @@
Loading
254 256
	return nothing
255 257
end
256 258
257 -
run1exp = false
258 -
runmanyexp = true
259 +
run1exp = true
260 +
runmanyexp = false
259 261
runkf = false
260 262
if run1exp
261 263
	# Single experiment and make associated video	
262 264
	display("Running a single experiment and making associated video")
263 -
	num_particles = 1000
265 +
	num_particles = 500
264 266
	num_iter = 100
265 267
	meascov = 5	
266 268
	plots, rmse = runexp(num_particles=num_particles,num_iter=num_iter,meascov=meascov)
267 269
	@show length(plots) # Should be equal to the number of iterations of the particle filter
268 270
	makegif = true
269 -
	if makegif write_particles_gif(plots,"../img/25June_$(num_particles)particles_$(num_iter)iterations_$(meascov)meascov.mp4") end
271 +
	if makegif write_particles_gif(plots,"../img/26June_$(num_particles)particles_$(num_iter)iterations_$(meascov)meascov.mp4") end
270 272
end
271 273
if runmanyexp
272 274
	# Mulitple experiments to make average rmse plot

@@ -122,8 +122,7 @@
Loading
122 122
		new_p_mat = rand(p_distb,re.n)
123 123
		new_p_array = slicematrix(new_p_mat')
124 124
			#XXX Printing things
125 -
			#print("\nFitted distb: $(p_distb)\n")
126 -
			#@show p_distb			
125 +
			#print("\nFitted distb: $(p_distb)\n")		
127 126
			#print("\n after sampling from fitted distribution\n")
128 127
			#print_particles(ParticleCollection(new_p_array))
129 128
		return ParticleCollection(new_p_array)
Files Coverage
src 20.71%
Project Totals (15 files) 20.71%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading