# How should I understand sequential importance resampling in a particle filter?

Suppose I implement a particle filter with $n$ particles. This is a brief description of my understanding of a particle filter.

For the first step, I throw out $n$ particles some distance from my vehicle. I weight the particles according to some Gaussian distribution:

$$w_{j,t} = \frac{e^{-X_{j,t}^{2}/2\sigma^{2}}}{\sum_{j=1}^n{e^-{X_{j,t}^{2}/2\sigma^{2}}}}$$

where $X_{j,t}$ is some (noisy) difference between a measurement taken at the vehicle and at the particle taken at time t. I then translate these particles with my vehicle (with some uncertainty) and do the same thing again, and the weights of these particles (the same particle pool) is

$$w_{j,t+1} = \frac{e^{-X_{j,t+1}^{2}/2\sigma^{2}}}{\sum_{j=1}^n{e^{-X_{j,t+1}^{2}/2\sigma^{2}}}} w_{j,t}$$

We resample if, according to wikipedia, $K = 1/\sum_j{w_{j,t}^2} < thresh$, where thresh is some threshold we pick. Resampling is done according to each particles weight (the probability of being chosen is given by that particle's weight).

My question is thus: if $K<thresh$, that means that some particles are highly weighted. So won't resampling give us a very degenerate list of the highest weighted particles, on average? Suppose this new, resampled population is composed of only n/2 different particles, 2 times each. How do you get n particles back?

• Have you taken a look at this answer: robotics.stackexchange.com/questions/479/… ? Aug 16 '18 at 7:24
• Yes, but the top answer doesn't quite answer my question. If my new population - after resampling - contains multiple of the same particle, won't I lose potential variation? If I start with 100 particles, resample, and end up with 99 different particles (one has a duplicate), I will always have at most 99 unique particles. Am I to add noise to these particles so that they aren't in the same spot? Aug 16 '18 at 13:40
• Are you normalizing your weights so they add to 1? Aug 16 '18 at 13:50
• Yes, I am. This is the first equation in the question Aug 16 '18 at 13:51
• Basically my question amounts to how I can have n unique particles at every time step if resampling can force me to choose more than 1 of the same particle. Aug 16 '18 at 13:52

After thinking about the problem, I believe the answer lies in the noise. You translate your particle "batch" every time step, and re weight each time. If $K < thresh$, you resample, with potential degeneracy. However, you don't know the position of your vehicle with infinite precision, and so all particles get moved with some error, and this removes the degeneracy. The previously degenerate particles retain their "influence" because you have more particles in a certain region depending on the degeneracy. The more highly degenerate a particle, the more particles test the next area around where the previously degenerate particle would be without noise to gain even greater precision.