Regulariser
Particle
- class stonesoup.regulariser.particle.MCMCRegulariser(transition_model: TransitionModel = None, constraint_func: Callable = None)[source]
Bases:
Regulariser
Markov chain Monte-Carlo (MCMC) move steps, or regularisation steps, can be implemented in particle filters to prevent sample impoverishment that results from resampling. One way of avoiding this is to only perform resampling when deemed necessary by some measure of effectiveness. Sometimes this is not desirable, or possible, when a particular algorithm requires the introduction of new samples as part of the filtering process for example.
This is a particular implementation of a MCMC move step that uses the Metropolis-Hastings algorithm [1]. After resampling, particles are moved a small amount, according do a Gaussian kernel, to a new state only if the Metropolis-Hastings acceptance probability is met by a random number assigned to each particle from a uniform random distribution, otherwise they remain the same. Further details on the implementation are given in [2].
References
- Parameters:
transition_model (
TransitionModel
, optional) – Transition model used for predictionconstraint_func (
collections.abc.Callable
, optional) – Callable, user defined function for applying constraints to particle states. This is done by reverting particles that are moved to a state outside of the defined constraints back to the state prior to the move step. Particle states that are input are assumed to be constrained. This function provides indices of the unconstrained particles and should accept aParticleState
object and return an array-like object of logical indices.
- transition_model: TransitionModel
Transition model used for prediction
- constraint_func: Callable
Callable, user defined function for applying constraints to particle states. This is done by reverting particles that are moved to a state outside of the defined constraints back to the state prior to the move step. Particle states that are input are assumed to be constrained. This function provides indices of the unconstrained particles and should accept a
ParticleState
object and return an array-like object of logical indices.
- regularise(prior, posterior, **kwargs)[source]
Regularise the particles
- Parameters:
prior (
ParticleState
type) – prior particle distribution.posterior (
ParticleState
type) – posterior particle distribution.
- Returns:
particle state – The particle state after regularisation
- Return type:
- class stonesoup.regulariser.particle.MultiModelMCMCRegulariser(transition_models: Sequence[TransitionModel], model_mappings: Sequence[Sequence[int]], constraint_func: Callable = None)[source]
Bases:
MCMCRegulariser
MCMC Regulariser for
MultiModelParticleState
This is a version of the
MCMCRegulariser
that supports case where multiple models are used i.e. withMultiModelParticleUpdater
.- Parameters:
transition_models (
collections.abc.Sequence
) – Transition models used to for particle transition, selected by model index on particle. Models dimensions can be subset of the overall state space, by usingmodel_mappings
.model_mappings (
collections.abc.Sequence
) – Sequence of mappings associated with each transition model. This enables mapping between model and state space, enabling use of models that may have different dimensions (e.g. velocity or acceleration). Parts of the state that aren’t mapped are set to zero.constraint_func (
collections.abc.Callable
, optional) – Callable, user defined function for applying constraints to particle states. This is done by reverting particles that are moved to a state outside of the defined constraints back to the state prior to the move step. Particle states that are input are assumed to be constrained. This function provides indices of the unconstrained particles and should accept aParticleState
object and return an array-like object of logical indices.
- transition_model: TransitionModel = None
- transition_models: Sequence[TransitionModel]
Transition models used to for particle transition, selected by model index on particle. Models dimensions can be subset of the overall state space, by using
model_mappings
.