Particle Resampling

Several different resampling methods are supported by GenParticleFilters.jl, each with their own variance properties.

GenParticleFilters.pf_resample!Function
pf_resample!(state::ParticleFilterState, method=:multinomial; kwargs...)

Resamples particles in the filter, stochastically pruning low-weight particles. The resampling method can optionally be specified: :multinomial (default), :residual, or :stratified. See [1] for a survey of resampling methods and their variance properties.

[1] R. Douc and O. Cappé, "Comparison of resampling schemes for particle filtering," in ISPA 2005. Proceedings of the 4th International Symposium on Image and Signal Processing and Analysis, 2005., 2005, pp. 64–69.

source

Multinomial resampling

GenParticleFilters.pf_multinomial_resample!Function
pf_multinomial_resample!(state::ParticleFilterState; kwargs...)

Performs multinomial resampling (i.e. simple random resampling) of the particles in the filter. Each trace (i.e. particle) is resampled with probability proportional to its weight.

Keyword Arguments

  • priority_fn = nothing: An optional function that maps particle weights to custom log priority scores (e.g. w -> w/2 for less aggressive pruning).
  • check = :warn: Set to true to throw an error for invalid normalized weights (all NaNs or zeros), :warn to issue warnings, or false to suppress checks. In the latter two cases, zero weights will be renormalized to uniform weights for resampling.
source

Residual resampling

GenParticleFilters.pf_residual_resample!Function
pf_residual_resample!(state::ParticleFilterState; kwargs...)

Performs residual resampling of the particles in the filter, which reduces variance relative to multinomial sampling. For each particle with normalized weight $w_i$, $⌊n w_i⌋$ copies are resampled, where $n$ is the total number of particles. The remainder are sampled with probability proportional to $n w_i - ⌊n w_i⌋$ for each particle $i$.

Keyword Arguments

  • priority_fn = nothing: An optional function that maps particle weights to custom log priority scores (e.g. w -> w/2 for less aggressive pruning).
  • check = :warn: Set to true to throw an error for invalid normalized weights (all NaNs or zeros), :warn to issue warnings, or false to suppress checks. In the latter two cases, zero weights will be renormalized to uniform weights for resampling.
source

Stratified resampling

GenParticleFilters.pf_stratified_resample!Function
pf_stratified_resample!(state::ParticleFilterState; kwargs...)

Performs stratified resampling of the particles in the filter, which reduces variance relative to multinomial sampling. First, uniform random samples $u_1, ..., u_n$ are drawn within the strata $[0, 1/n)$, ..., $[n-1/n, 1)$, where $n$ is the number of particles. Then, given the cumulative normalized weights $W_k = Σ_{j=1}^{k} w_j$, sample the $k$th particle for each $u_i$ where $W_{k-1} ≤ u_i < W_k$.

Keyword Arguments

  • priority_fn = nothing: An optional function that maps particle weights to custom log priority scores (e.g. w -> w/2 for less aggressive pruning).
  • check = :warn: Set to true to throw an error for invalid normalized weights (all NaNs or zeros), :warn to issue warnings, or false to suppress checks. In the latter two cases, zero weights will be renormalized to uniform weights for resampling.
  • sort_particles = true: Set to true to sort particles by weight before stratification.
source