A particle filter (also known as a Sequential Monte Carlo method) is a computational algorithm used for estimating the state of a dynamic system when the system is partially observable and/or affected by noise. It is widely used in robotics, computer vision, tracking, and signal processing.
Key Concepts:
-
State Estimation Problem:
- You want to track the hidden state ( x_t ) of a system (e.g., a robot's position, object velocity) over time.
- Observations ( z_t ) (measurements) are noisy and indirect.
- The system evolves under uncertainty (process noise).
-
Bayesian Framework:
- Particle filters approximate the posterior probability distribution ( p(x_t | z_{1:t}) ) (probability of state ( x_t ) given all observations ( z_1 ) to ( z_t )).
- This is done using Bayes' theorem and sequential updates.
-
Monte Carlo Sampling:
- Instead of computing complex integrals (as in Kalman filters), particle filters represent the posterior distribution with a set of random samples (called "particles").
- Each particle is a hypothesis about the system's state, with an associated weight representing its likelihood.
How a Particle Filter Works:
1. Initialization:
- Generate ( N ) particles ( {x_0^{(i)}}_{i=1}^N ) from the initial distribution ( p(x_0) ).
- Assign uniform weights: ( w_0^{(i)} = \frac{1}{N} ).
2. Recursive Steps (for each time ( t )):
a) Prediction (Propagate particles):
- For each particle ( x_{t-1}^{(i)} ), sample a new state ( \tilde{x}_t^{(i)} ) from the transition model:
[
\tilde{x}t^{(i)} \sim p(x_t | x{t-1}^{(i)})
]
(This predicts the next state using the system's motion/dynamics model.)
b) Update (Weight adjustment):
- Compute a new weight for each particle using the observation model:
[
w_t^{(i)} = w_{t-1}^{(i)} \cdot p(z_t | \tilde{x}_t^{(i)})
]
(Particles that align with the current observation ( z_t ) get higher weights.)
- Normalize weights: ( \tilde{w}_t^{(i)} = \frac{w_t^{(i)}}{\sum_j w_t^{(j)}} ).
c) Resampling:
- Problem: Over time, most particles end up with negligible weights ("degeneracy").
- Solution: Resample ( N ) particles (with replacement) proportional to ( \tilde{w}_t^{(i)} ).
- High-weight particles are duplicated; low-weight particles are discarded.
- Reset weights to ( \frac{1}{N} ).
Advantages & Limitations:
| Pros | Cons |
|---|
| ✅ Handles non-linear systems. | ❌ Computationally expensive (large ( N ) needed). |
| ✅ Handles non-Gaussian noise. | ❌ Degeneracy without resampling. |
| ✅ Flexible and easy to implement. | ❌ "Sample impoverishment" (loss of diversity). |
Example Applications:
- Robot Localization: Track a robot’s pose in a known map with noisy sensors.
- Object Tracking: Follow a moving object in video (e.g., cars in traffic).
- Financial Modeling: Estimate hidden states in time-series data.
Intuition:
Imagine tracking a car in fog:
- Particles: Thousands of "guesses" about the car’s location.
- Weight: Adjust guesses based on how well they match radar blips.
- Resampling: Focus computational effort on high-probability areas.
Pseudocode:
Initialize particles: {x₀⁽ⁱ⁾, w₀⁽ⁱ⁾=1/N} for i=1..N
For each timestep t:
For each particle i:
Sample xₜ⁽ⁱ⁾ ~ p(xₜ | xₜ₋₁⁽ⁱ⁾) // Prediction
Update weight: wₜ⁽ⁱ⁾ ∝ p(zₜ | xₜ⁽ⁱ⁾) // Update
Normalize weights
Resample particles based on weights
Particle filters bridge the gap between complex real-world uncertainty and tractable computation by leveraging random sampling and Darwinian selection.