GeneralisedFilters

Installation

In the julia REPL:

] add GeneralisedFilters

Documentation

GeneralisedFilters provides implementations of various filtering and smoothing algorithms for state-space models (SSMs). The goal of the package is to provide a modular and extensible framework for implementing advanced algorithms including Rao-Blackwellised particle filters, two-filter smoothers, and particle Gibbs/conditional SMC. Performance is a primary focus of this work, with type stability, GPU-acceleration, and efficient history storage being key design goals.

Interface

GeneralisedFilters.BackwardInformationPredictorType
BackwardInformationPredictor

An algorithm to recursively compute the predictive likelihood p(y{t:T} | xt) of a linear Gaussian state space model in information form.

This implementation is based on https://arxiv.org/pdf/1505.06357

source
GeneralisedFilters.HierarchicalStateType

A container for a sampled state from a hierarchical SSM, with separation between the outer and inner dimensions. Note this differs from a RBState in the the inner state is a sample rather than a conditional distribution.

source
GeneralisedFilters.ParticleType
Particle

A container representing a single particle in a particle filter distribution, composed of a weighted sampled (stored as a log weight) and its ancestor index.

source
GeneralisedFilters.ParticleDistributionType
ParticleDistribution

A container for particle filters which composes a collection of weighted particles (with their ancestories) into a distibution-like object.

Fields

  • particles::VT: Vector of weighted particles
  • ll_baseline::WT: Baseline for computing log-likelihood increment. A scalar that caches the unnormalized logsumexp of weights before update (for standard PF/guided filters) or a modified value that includes APF first-stage correction (for auxiliary PF).
source
GeneralisedFilters.RBStateType
RBState

A container representing a single state with a Rao-Blackwellised component. This differs from a HierarchicalState which contains a sample of the conditionally analytical state rather than the distribution itself.

Fields

  • x::XT: The sampled state component
  • z::ZT: The Rao-Blackwellised distribution component
source
GeneralisedFilters.ResamplerCallbackType
ResamplerCallback

A callback which follows the resampling indices over the filtering algorithm. This is more of a debug tool and visualizer for various resapmling algorithms.

source
GeneralisedFilters.backward_predictMethod
backward_predict(rng, dyn, algo, iter, state; prev_outer=nothing, next_outer=nothing, kwargs...)

Perform a backward prediction step to compute p(y{t+1:T} | xt) from p(y{t:T} | x{t+1}).

source
GeneralisedFilters.compute_marginal_predictive_likelihoodMethod
compute_marginal_predictive_likelihood(forward_dist, backward_dist)

Compute the marginal predictive likelihood p(y{t:T} | y{1:t-1}) given a one-step predicted filtering distribution p(x{t+1} | y{1:t}) and a backward predictive likelihood p(y{t+1:T} | x{t+1}).

This Gaussian implementation is based on Lemma 1 of https://arxiv.org/pdf/1505.06357

source
GeneralisedFilters.marginalise!Method
marginalise!(state::ParticleDistribution)

Compute the log-likelihood increment and normalize particle weights. This function:

  1. Computes LSE of current (post-observation) log-weights
  2. Calculates llincrement = LSEafter - ll_baseline
  3. Normalizes weights by subtracting LSE_after
  4. Resets ll_baseline to 0.0

The llbaseline field handles both standard particle filter and auxiliary particle filter cases through a single-scalar caching mechanism. For standard PF, llbaseline equals the LSE before adding observation weights. For APF with resampling, it includes first-stage correction terms computed during the APF resampling step.

source
GeneralisedFilters.stepFunction
step([rng,] model, algo, iter, state, observation; kwargs...)

Perform a combined predict and update call of the filtering on the state.

source
GeneralisedFilters.updateFunction
update(model, algo, iter, proposed, observation; kwargs...)

Update beliefs on the propagated distribution given an observation.

source
GeneralisedFilters.will_resampleMethod
will_resample(resampler::AbstractResampler, state::ParticleDistribution)

Determine whether a resampler will trigger resampling given the current particle state. For uncondition resamplers, always returns true. For conditional resamplers (e.g., ESSResampler), checks the resampling condition.

source