MarkovKernels.jl

Marginal distributions and Markov kernels that play nice with each other for the purpose of Bayesian state estimation.
Author filtron
Popularity
17 Stars
Updated Last
3 Months Ago
Started In
April 2022

MarkovKernels.jl

A package implementing distributions, Markov kernels, and likelihoods that all play nice with eachother. The main motivation is to simplify the implementation of Bayesian filtering and smoothing algorithms. Let $\pi(x)$ be a probability distribution and $k(y\mid x)$ a Markov kernel then only the following operations are required for Bayesian state estimation

  • Marginalization:

$$ k(y) = \int k(y\mid x) \pi(x) \mathrm{d} x, $$

which gives the prediction step in Bayesian filtering.

  • Inverse factorization:

$$ k(y\mid x)\pi(x) = \pi(x \mid y) k(y), $$

where evaluation of $\pi(x \mid y)$ at $y$ gives Bayes' rule and $k(y)$ is the marginal distribution of $y$ (used for prediction error decomposition of the marginal likelihood). In fact, the prediction step may be implemented with the inverse factorization operation as well, in which case $\pi(x\mid y)$ is the backwards kernel used to compute smoothing distributions in the Rauch-Tung-Striebel recursion. Please see the tutorials in the documentation.

Stable Dev Build Status Coverage

Installation

] add MarkovKernels

Package specific types

Types for representing marginal distributions, Markov kernels, and likelihoods:

abstract type AbstractAffineMap end # used to represent affine conditional means

abstract type AbstractDistribution end
abstract type AbstractMarkovKernel end
abstract type AbstractLikelihood end

Currently, the following concrete types are defined:

Normal # Vector valued Normal distributons 
Dirac  # Vector valued Dirac distributions 

NormalKernel # Vector valued Normal kernels 
DiracKernel  # Vector valued Dirac kernels 

Likelihood   # AbstractMarkovKernel paired with a measurement 

The following type union is used to represent the (conditional) covariance:

const CovarianceParameter{T} = Union{HermOrSym{T},Factorization{T}}

Additionally, the following aliases are defined:

const AffineNormalKernel{T} = NormalKernel{T,<:AbstractAffineMap,<:CovarianceParameter}
const AffineDiracKernel{T} = DiracKernel{T,<:AbstractAffineMap}

Functions

For the purpose of Bayesian state estimation, ideally the following functions are defined:

marginalize(D::AbstractDistribution, K::AbstractMarkovKernel)
invert(D::AbstractDistribution, K::AbstractMarkovKernel)
posterior(D::AbstractDistribution, L::AbstractLikelihood)
posterior_and_loglike(D::AbstractDistribution, L::AbstractLikelihood)

These are currently implemented for Normal, AffineNormalKernel, AffineDiracKernel. Additionally, marginalize is implemented for Dirac with respect to the aforementioned kernels.

In practice, these functions can not be implemented exactly for a given distribution / Markov kernel pair. Therefore, it is up to the user to define, when required, appropriate approximations, i.e.:

predict(D::AbstractDistribution, K::AbstractMarkovKernel)
update(D::AbstractDistribution, L::AbstractLikelihood)

Used By Packages

No packages found.