Principle:Pyro ppl Pyro Sequential Monte Carlo
| Knowledge Sources | |
|---|---|
| Domains | Sequential Monte Carlo, State Estimation, Filtering |
| Last Updated | 2026-02-09 09:00 GMT |
Overview
Sequential Monte Carlo (SMC) filtering approximates the posterior distribution over latent states in dynamical systems by propagating and reweighting a set of particles through time.
Description
Many real-world systems evolve over time: objects move through space, financial markets fluctuate, epidemics spread. These systems are modeled as state-space models (also called hidden Markov models in the discrete case), where:
- A latent state z_t evolves according to a transition model p(z_t | z_{t-1}).
- Observations x_t are generated from the state via an observation model p(x_t | z_t).
The goal of filtering is to compute the posterior p(z_t | x_{1:t}) -- the distribution over the current state given all observations so far. Exact computation is generally intractable for nonlinear, non-Gaussian models.
SMC filtering (particle filtering) approximates this posterior using a weighted set of particles {(z_t^{(i)}, w_t^{(i)})}_{i=1}^N. At each time step:
- Propagate: Move each particle forward using a proposal distribution (often the transition model itself): z_t^{(i)} ~ q(z_t | z_{t-1}^{(i)}, x_t).
- Reweight: Assign importance weights based on how well the proposed state explains the observation: w_t^{(i)} proportional to p(x_t | z_t^{(i)}) * p(z_t^{(i)} | z_{t-1}^{(i)}) / q(z_t^{(i)} | z_{t-1}^{(i)}, x_t).
- Resample: If the effective sample size drops too low (weight degeneracy), resample particles with replacement according to their weights, then reset weights to uniform.
SMC combines the flexibility of Monte Carlo methods (no linearity or Gaussianity assumptions) with the sequential structure of filtering (constant memory in the time dimension).
Usage
Use SMC filtering when:
- Tracking latent states in nonlinear or non-Gaussian dynamical systems.
- The Kalman filter assumptions (linear dynamics, Gaussian noise) are violated.
- Online inference is needed as new observations arrive sequentially.
- Estimating marginal likelihoods for model comparison in time-series models.
- Performing inference in probabilistic programs with sequential structure.
Theoretical Basis
State-space model:
# Initial state: z_0 ~ p(z_0)
# Transition: z_t | z_{t-1} ~ p(z_t | z_{t-1})
# Observation: x_t | z_t ~ p(x_t | z_t)
# Filtering distribution:
# p(z_t | x_{1:t}) = p(x_t | z_t) * p(z_t | x_{1:t-1}) / p(x_t | x_{1:t-1})
# Prediction:
# p(z_t | x_{1:t-1}) = integral p(z_t | z_{t-1}) * p(z_{t-1} | x_{1:t-1}) dz_{t-1}
Bootstrap particle filter (simplest SMC):
# Initialize: for i = 1, ..., N:
# z_0^{(i)} ~ p(z_0)
# w_0^{(i)} = p(x_0 | z_0^{(i)})
# For t = 1, 2, ...:
# # Resample if ESS < threshold:
# if ESS({w_{t-1}^{(i)}}) < N/2:
# resample indices a^{(i)} ~ Categorical(w_bar_{t-1})
# reset weights to 1/N
# else:
# a^{(i)} = i
# # Propagate:
# z_t^{(i)} ~ p(z_t | z_{t-1}^{a^{(i)}})
# # Reweight:
# w_t^{(i)} = w_{t-1}^{a^{(i)}} * p(x_t | z_t^{(i)})
# Filtering estimate:
# E[f(z_t) | x_{1:t}] approx sum_i w_bar_t^{(i)} * f(z_t^{(i)})
Marginal likelihood estimation:
# SMC provides an unbiased estimate of the marginal likelihood:
# p(x_{1:T}) = product_{t=0}^{T} p(x_t | x_{1:t-1})
# Estimate:
# p_hat(x_{1:T}) = product_{t=0}^{T} (1/N * sum_i w_t^{(i)})
# This is unbiased (not just consistent), making it suitable
# for use in pseudo-marginal MCMC
Effective sample size:
# ESS measures the degeneracy of importance weights:
# ESS = (sum_i w_i)^2 / sum_i w_i^2
# ESS = N: all weights equal (no degeneracy)
# ESS = 1: one particle has all the weight (complete degeneracy)
# Resample when ESS < N/2 (common heuristic)