Particle Rejuvenation
To increase particle diversity (e.g. after a resampling step), GenParticleFilters.jl provides support for both MCMC and move-reweight rejuvenation kernels.
GenParticleFilters.pf_rejuvenate!
— Functionpf_rejuvenate!(state::ParticleFilterState, kern, kern_args::Tuple=(),
n_iters::Int=1; method=:move, kwargs...)
Rejuvenates particles by repeated application of a kernel kern
. kern
should be a callable which takes a trace as its first argument, and returns a tuple with a trace as the first return value. method
specifies the rejuvenation method: :move
for MCMC moves without a reweighting step, and :reweight
for rejuvenation with a reweighting step. Additional keyword arguments are passed to the kernel.
MCMC rejuvenation
MCMC rejuvenation can be used to diversify the set of existing particles by applying an invariant MCMC kernel (e.g. a Metropolis-Hastings kernel) to each particle. Since the kernel is expected to be invariant, kernel application does not adjust the particle weights.
GenParticleFilters.pf_move_accept!
— Functionpf_move_accept!(state::ParticleFilterState, kern,
kern_args::Tuple=(), n_iters::Int=1; kwargs...)
Rejuvenates particles by repeated application of a MCMC kernel kern
. kern
should be a callable which takes a trace as its first argument, and returns a tuple (trace, accept)
, where trace
is the (potentially) new trace, and accept
is true if the MCMC move was accepted. Subsequent arguments to kern
can be supplied with kern_args
or kwargs
. The kernel is repeatedly applied to each trace for n_iters
.
Move-reweight rejuvenation
Move-reweight rejuvenation can be used to simultaneously diversify the set of existing particles while updating their weights.
GenParticleFilters.pf_move_reweight!
— Functionpf_move_reweight!(state::ParticleFilterState, kern,
kern_args::Tuple=(), n_iters::Int=1; kwargs...)
Rejuvenates and reweights particles by repeated application of a reweighting kernel kern
, as described in [1]. kern
should be a callable which takes a trace as its first argument, and returns a tuple (trace, rel_weight)
, where trace
is the new trace, and rel_weight
is the relative log-importance weight. Subsequent arguments to kern
can be supplied with kern_args
or kwargs
. The kernel is repeatedly applied to each trace for n_iters
, and the weights accumulated accordingly.
Both the move_reweight
function and symmetric trace translators can serve as reweighting kernels.
[1] R. A. G. Marques and G. Storvik, "Particle move-reweighting strategies for online inference," Preprint series. Statistical Research Report, 2013.
To define a move-reweight kernel, the following methods are provided:
GenParticleFilters.move_reweight
— Functionmove_reweight(trace, selection; kwargs...)
move_reweight(trace, proposal, proposal_args; kwargs...)
move_reweight(trace, proposal, proposal_args, involution; kwargs...)
move_reweight(trace, proposal_fwd, args_fwd, proposal_bwd, args_bwd,
involution ; kwargs...)
Move-reweight rejuvenation kernel, which takes in a trace
and returns a new trace along with a relative importance weight. This can be used for rejuvenation within a particle filter, as described in [1].
Several variants of move_reweight
exist, differing in the complexity involved in proposing and re-weighting random choices:
- The
selection
variant regenerates the addresses specified byselection
using the model's default proposal. - A
proposal
generative function and arguments can be provided, to propose new random choices using a custom proposal distribution.proposal
must take the original trace as its first input argument. - An
involution
can also be provided, to handle more complex proposal distributions which add/remove trace addresses. - Separate forward and backward proposal distributions,
proposal_fwd
andproposal_bwd
, can be provided, as long they share the same support. This adjusts the computation of the relative importance weight by scoring the backward choices under the backward proposal.
Similar to metropolis_hastings
, a check
flag and observations
choicemap can be provided as keyword arguments to ensure that observed choices are preserved in the new trace.
[1] R. A. G. Marques and G. Storvik, "Particle move-reweighting strategies for online inference," Preprint series. Statistical Research Report, 2013.
Care must be taken in choosing forward and backward kernels to reduce variance in the weight updates. A helpful rule-of-thumb when specifying backward kernels is to try and make them locally optimal: If $\pi(x)$ is the initial distribution of particles prior to the rejuvenation move, and $K(x'; x)$ is the forward kernel that will be applied to perturb each particle, then the backward kernel $L(x; x')$ should be designed to approximate the local posterior $P(x | x') \propto \pi(x) K(x'; x)$.