Resampler

class stonesoup.resampler.base.Resampler[source]

Bases: stonesoup.base.Base

Resampler base class

Particle

class stonesoup.resampler.particle.SystematicResampler[source]

Bases: stonesoup.resampler.base.Resampler

resample(particles)[source]

Resample the particles

Parameters

particles (list of Particle) – The particles to be resampled according to their weight

Returns

particles – The resampled particles

Return type

list of Particle

class stonesoup.resampler.particle.ESSResampler(threshold: float = None, resampler: Resampler = <class 'SystematicResampler'>)[source]

Bases: stonesoup.resampler.base.Resampler

This wrapper uses a Resampler to resample the particles inside an instant of Particles, but only after checking if this is necessary by comparing Effective Sample Size (ESS) with a supplied threshold (numeric). Kish’s ESS is used, as recommended in Section 3.5 of this tutorial 1.

References

1

Doucet A., Johansen A.M., 2009, Tutorial on Particle Filtering and Smoothing: Fifteen years later, Handbook of Nonlinear Filtering, Vol. 12.

Parameters
  • threshold (float, optional) – Threshold compared with ESS to decide whether to resample. Default is number of particles divided by 2, set in resample method

  • resampler (Resampler, optional) – Resampler to wrap, which is called when ESS below threshold

threshold: float

Threshold compared with ESS to decide whether to resample. Default is number of particles divided by 2, set in resample method

resampler: stonesoup.resampler.base.Resampler

Resampler to wrap, which is called when ESS below threshold

resample(particles)[source]
Parameters

particles (list of Particle) – The particles to be resampled according to their weight

Returns

particles – The particles, either unchanged or resampled, depending on weight degeneracy

Return type

list of Particle