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 (
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)[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: