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
- Marginalization:
which gives the prediction step in Bayesian filtering.
- Inverse factorization:
where evaluation of
] add MarkovKernels
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}
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)