Resampler

class stonesoup.resampler.base.Resampler[source]

Bases: Base

Resampler base class

Particle

class stonesoup.resampler.particle.SystematicResampler[source]

Bases: Resampler

resample(particles)[source]

Resample the particles

Parameters:

particles (ParticleState or list of Particle) – The particles or particle state to be resampled according to their weights

Returns:

particle state – The particle state after resampling

Return type:

ParticleState

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

Bases: 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

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: 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