Foundations to Frontier
Tests
A. Mathematical Foundations › A10 Signal Processing

Particle Filters

When dynamics or measurements are strongly nonlinear, or the belief has several peaks, Gaussian filters break down. Particle filters represent the posterior with a cloud of weighted samples: predict each particle with the model, weight it by the measurement likelihood, and resample. This topic covers sequential importance sampling and resampling, weight degeneracy and the effective sample size, resampling schemes, log-weight numerics, the curse of dimensionality, and practical fixes. You will beat the EKF on a classic bimodal benchmark, then implement Monte Carlo localization for a robot that starts completely lost in a corridor of doors.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

A crowd of guesses

You wake up in a long hallway with identical-looking doors and no idea where you are. Imagine a thousand clones of you, each guessing a different spot. Everyone walks forward together. When you pass a door, clones whose guess puts a door nearby get more votes, and the rest get fewer. Then the crowd is reshuffled so popular guesses are copied and unpopular ones fade. After a few doors, the whole crowd gathers around your true position. That’s a particle filter.

Particle filter: a lost robot finds itself
robotparticle histogram (belief) · doors in purple
step 0 · median estimate 10.70 m, 68% spread ±6.67 (true 1.00 m) · effective sample size before resampling 1000
Particles are guesses of the robot's position. Each step moves them with the motion model, weights them by how well the door detector agrees, and resamples so likely guesses multiply. Early on, every door looks alike and the belief has several peaks, something a single-Gaussian Kalman filter cannot represent. Once the robot passes a distinctive door spacing, one peak survives. After a kidnapping, a few randomly injected particles let the filter recover.
Why engineers care

Robot localization (Monte Carlo localization), visual tracking, terrain-relative navigation, and nonlinear estimation problems where beliefs can split into several possibilities all use particle filters. Their strength is handling multiple hypotheses. Their weakness is cost in high dimensions.

📝 Quick check (Level 0)
0/3 answered
  1. 1. A particle filter represents belief with…
  2. 2. Particles that agree with a measurement get…
  3. 3. Unlike a Kalman filter, a particle filter can represent…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

The bootstrap filter

For particles {x(i)}i=1N\{x^{(i)}\}_{i=1}^N, repeat:

  1. Predict: x(i)∼p(xk∣xk−1(i))x^{(i)}\sim p(x_k\mid x_{k-1}^{(i)}) (simulate the model with noise).
  2. Weight: w(i)∝p(zk∣x(i))w^{(i)}\propto p(z_k\mid x^{(i)}), then normalize.
  3. Estimate: x^=∑w(i)x(i)\hat x = \sum w^{(i)}x^{(i)} (or the MAP or median).
  4. Resample: draw N particles with probabilities w(i)w^{(i)}, and reset the weights to 1/N.

(Gordon, Salmond and Smith, 1993.)

Effective sample size

Neff=1∑i(w(i))2N_{\mathrm{eff}} = \frac1{\sum_i(w^{(i)})^2}

It runs from N (equal weights) down to 1 (a single particle carries everything). Resample when NeffN_{\mathrm{eff}} drops below about N/2.

📝 Quick check (Level 1)
0/3 answered
  1. 1. N_eff for 4 equal weights:
  2. 2. Resampling…
  3. 3. The bootstrap filter's proposal is…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 40 minUndergraduate students and practising engineers.

Why it works: sequential importance sampling

We want expectations under the posterior p(xk∣z1:k)p(x_k\mid z_{1:k}). Sampling from a proposal q and weighting by p/qp/q is importance sampling (a8-7). With the motion model as proposal, the weight ratio reduces to the likelihood. As N → ∞, weighted averages converge to posterior expectations (Del Moral, 2004).

Practicalities

  • Degeneracy: without resampling, after a few steps one particle holds all the weight.
  • Resampling schemes: multinomial; systematic (one uniform draw, low variance, O(N)); stratified; residual.
  • Sample impoverishment: after resampling, many duplicates. Add roughening jitter or MCMC moves. For kidnapped-robot recovery, inject a few random particles.
  • Log-weights: compute log⁡w\log w, subtract the maximum, then exponentiate. Products of likelihoods underflow otherwise (a8-3).
  • Curse of dimensionality: the required N grows exponentially with the effective dimension (Snyder et al., 2008). Rao–Blackwellization (FastSLAM) handles linear substructure analytically.
🐍 Exercise 1: bootstrap PF vs EKF on a bimodal benchmark
Implement systematic resampling, ESS and a bootstrap particle filter. On the classic Gordon nonlinear benchmark (measurement z = x²/20, so the sign of x is ambiguous), compare PF and EKF RMSE over 10 runs.
📝 Quick check (Level 2)
0/3 answered
  1. 1. Systematic resampling uses…
  2. 2. Particle filters scale poorly with…
  3. 3. Weights should be computed in log space to avoid…

Level 3: Advanced

★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.

Importance weights for the bootstrap proposal

The target over trajectories is p(x0:k∣z1:k)∝p(x0:k−1∣z1:k−1)p(xk∣xk−1)p(zk∣xk)p(x_{0:k}\mid z_{1:k})\propto p(x_{0:k-1}\mid z_{1:k-1})p(x_k\mid x_{k-1})p(z_k\mid x_k). The proposal is p(x0:k−1∣z1:k−1)p(xk∣xk−1)p(x_{0:k-1}\mid z_{1:k-1})p(x_k\mid x_{k-1}). Their ratio is p(zk∣xk)p(z_k\mid x_k), so the weight update is just the likelihood. ∎

Systematic resampling is unbiased

Particle i receives #{j:(u+j)/N∈(ci−1,ci]}\#\{j: (u + j)/N\in(c_{i-1}, c_i]\} copies, which is ⌊Nwi⌋\lfloor Nw_i\rfloor or ⌈Nwi⌉\lceil Nw_i\rceil, with expectation exactly NwiNw_i. ∎

Why N_eff measures degeneracy

For importance sampling, the variance of a weighted estimate is roughly that of a plain Monte Carlo estimate with Neff≈N/(1+Var⁡(w)/wˉ2)N_{\mathrm{eff}}\approx N/(1 + \operatorname{Var}(w)/\bar w^2) samples (Kong, Liu and Wong, 1994). 1/∑w21/\sum w^2 is its practical estimator.

Exercise 3.1: N_eff for weights (0.5, 0.5, 0, 0)

1/(0.25+0.25)=21/(0.25 + 0.25) = 2: effectively only 2 useful particles.

📝 Quick check (Level 3)
0/3 answered
  1. 1. With the bootstrap proposal, the weight update equals…
  2. 2. Systematic resampling gives each particle a count of…
  3. 3. N_eff for weights (0.5, 0.5, 0, 0):

Level 4: Expert

★★★★★ Expert⏱ 35 minResearchers: original papers and open problems.

Monte Carlo localization in a corridor

A robot starts lost in a 20 m corridor with five doors and a noisy door detector. It moves 0.35 m per step. MCL (Dellaert, Fox, Burgard and Thrun, 1999) begins with 2000 uniformly spread particles. After the first few door sightings the belief has five separate clusters: every door is consistent with the data. A Gaussian filter would average them into nonsense. As the robot passes the door spacing pattern, the wrong hypotheses die out, and after 40 steps the estimate is within 5 cm of the truth with 0.3 m spread. On the Gordon benchmark, the PF’s RMSE is 4.6 versus 21.8 for the EKF, which cannot represent the ± ambiguity of x2/20x^2/20.

🐍 Exercise 2 (research): global localization with Monte Carlo localization
Implement MCL for a robot in a corridor with doors, starting from a uniform belief. Count the belief's modes early on (multimodal) and check convergence to the true position after 40 steps.

Particle filters in AI, robotics and aerospace

  • Robot localization: AMCL in ROS; FastSLAM (Montemerlo et al., 2002) combines particles with per-particle EKFs.
  • Terrain-relative navigation: particle filters match altimeter or radar profiles to terrain maps (TERCOM-like) for aircraft and landers.
  • Tracking: multi-target tracking with random finite sets (PHD filters); visual object tracking (Condensation; Isard and Blake, 1998).
  • Learning: sequential Monte Carlo for probabilistic programming and differentiable particle filters.

References

  1. N. Gordon, D. Salmond, A. Smith (1993). “Novel approach to nonlinear/non-Gaussian Bayesian state estimation.” IEE Proceedings F, 140(2).
  2. F. Dellaert, D. Fox, W. Burgard, S. Thrun (1999). “Monte Carlo localization for mobile robots.” ICRA.
  3. A. Doucet, N. de Freitas, N. Gordon (eds.) (2001). Sequential Monte Carlo Methods in Practice. Springer.
  4. M. S. Arulampalam, S. Maskell, N. Gordon, T. Clapp (2002). “A tutorial on particle filters for online nonlinear/non-Gaussian Bayesian tracking.” IEEE Trans. Signal Processing, 50(2).
  5. A. Kong, J. Liu, W. Wong (1994). “Sequential imputations and Bayesian missing data problems.” JASA, 89(425).
  6. C. Snyder, T. Bengtsson, P. Bickel, J. Anderson (2008). “Obstacles to high-dimensional particle filtering.” Monthly Weather Review, 136(12).
  7. M. Montemerlo, S. Thrun, D. Koller, B. Wegbreit (2002). “FastSLAM: a factored solution to the simultaneous localization and mapping problem.” AAAI.
  8. M. Isard, A. Blake (1998). “CONDENSATION: conditional density propagation for visual tracking.” IJCV, 29(1).