Localisation · University · about 30 min
Keeping the good guesses without losing the diversity that lets the filter recover.
[1 mark]What does this program print?
particles = ["A", "B", "C", "D"]
weights = [0.05, 0.5, 0.3, 0.15]
N = 4
step = 1.0 / N
r = 0.12
c = weights[0]
i = 0
fresh = []
for m in range(N):
u = r + m * step
while u > c and i < N - 1:
i += 1
c += weights[i]
fresh.append(particles[i])
print(" ".join(fresh))
[1 mark]With low variance resampling and N = 500, a particle has weight 0.013. How many copies does it get?
[1 mark]After many rounds of resampling without jitter, the filter is confidently and permanently wrong. What has happened?
[1 mark]Which of these defend against particle deprivation?
Tick every answer that is true.
[1 mark]Put the steps of low variance resampling in order.
Number the lines 1 to 5 to put them in the right order.
Set c to the first weight and i to 0For each m, set the pointer u = r + m * stepCopy particles[i], plus a little jitter, into the new setSet step = 1/N and draw a single number r between 0 and stepWhile u > c, move i on and add weights[i] to c[1 mark]Why is low variance resampling preferred to drawing N independent samples?
Weight a scattered cloud against one reading, then resample it. Print before: and after:, the effective sample size each side, and spread:, the standard deviation of the resampled cloud.
from bugbot import * import math, random connect() N, SIGMA = 500, 3.0 particles = [random.uniform(0, 200) for i in range(N)]
Plan your program here, then type it in and press Run.