Bootstrap Filter
The BootstrapFilter is the simplest filter provided by the library and should be the starting point for most tasks.
Quick Start
With a POMDPs.jl model, setup looks like this:
using ParticleFilters, POMDPModels
pomdp = TigerPOMDP()
pf = BootstrapFilter(pomdp, 10)Without POMDPs.jl, setup looks like this:
using ParticleFilters, Distributions
dynamics(x, u, rng) = x + u + randn(rng)
y_likelihood(x_previous, u, x, y) = pdf(Normal(), y - x)
pf = BootstrapFilter(dynamics, y_likelihood, 10)Once the filter has been created the update function can be used to perform a particle filter update.
b = ParticleCollection([1.0, 2.0, 3.0, 4.0])
u = 1.0
y = 3.0
b_new = update(pf, b, u, y)More on the Bootstrap Filter
The BootstrapFilter is designed to be a sensible default choice for starting with particle filtering. The basic bootstrap filter approach was first described in "Novel approach to nonlinear / non-Gaussian Bayesian state estimation" by Gordon, Salmond, and Smith. The version in this package first checks whether the normalized effective sample size of the particle belief is above a threshold (the resample_threshold argument). If it is below the threshold, the belief is resampled using low_variance_sample. The particles are then propagated through the dynamics model and weighted by the likelihood of the observation. 
The BootstrapFilter offers a modest level of customization. The most common need for customization is recovering from particle depletion. For this case, use the postprocess keyword argument to specify a function that can be used to check for depletion and recover. See the Handling Particle Depletion section for more information about this task. If more customization is needed, users should use the BasicParticleFilter.
ParticleFilters.BootstrapFilter — FunctionBootstrapFilter(pomdp, n; <keyword arguments>)
BootstrapFilter(dynamics, likelihood, n; <keyword arguments>)Construct a standard bootstrap particle filter.
Arguments
- pomdp::POMDP: A POMDP model from POMDPs.jl
- dynamics::Function: A function of the form- dynamics(x, u, rng)that returns the next state,- xp, given the current state,- x, and the action,- u. The random number generator,- rng, should be used to generate any necessary randomness.
- likelihood::Function: A function of the form- likelihood(x, u, xp, y)that returns the likelihood of observing- ygiven- x,- u, and- xp.
- n::Integer: number of particles
Keyword Arguments
- resample_threshold::Float64=0.9: normalized ESS threshold for resampling
- postprocess::Function=(bp, args...)->bp: a function to apply to the belief at the end of each update step. This function should have the form- postprocess(bp, b, a, o, rng)and should return a modified version of- bpwith any postprocessing changes made. See the Particle Depletion section of the ParticleFilters.jl documentation for more information.
- rng::AbstractRNG=Random.default_rng(): random number generator
For more explanation, see the Bootstrap Filter section of the ParticleFilters.jl package documentation. For a more flexible particle filter structure see BasicParticleFilter.