[ANN] KalmanFilters.jl

I’m pleased to announce KalmanFilters.jl.

Currently it supports the following filter types:

  • (Square Root) Kalman Filter ((SR-)KF)
  • (Square Root) Unscented Kalman Filter ((SR-)UKF)
  • (Square Root) Augment Unscented Kalman Filter ((SR-)AUKF)

It has very flexible structure. For example you are free to choose the type of the Kalman-Filter for the time update and measurement update independently. If you have a linear time update, you may choose the (linear) Kalman-Filter and if the measurement update is non-linear, you can choose the Unscented-Kalman-Filter for that or vice versa.
The distinction between the different Kalman-Filters is simply made by the input types:
If the model is defined by a Matrix, the linear Kalman-Filter will be used. If the model is defined by a function or a functor (in case you need to pass additional information), the implementation will assume, that the model is non-linear, and will, therefore, use the Unscented-Kalman-Filter.
If you’d like to augment the noise covariance, you will have to wrap the noise covariance by the Augment type.

All Kalman-Filter types support the square root variant. Those have an advantage compared to the normal Kalman-Filters in terms of numerical stability. In some cases they are even faster than the normal pendant. The square root variant is again determined by the input types: If you pass the cholesky factorizations of the covariances (instead of the covariances itself), the square root variant will be used.

All Kalman-Filters support to consider a subset of states. Considered states are states, that are considered in the model with its mean and variance, but are not updated in the update procedure.

This module is build with performance in mind. For every variant you will find an inplace version, that minimizes the allocation. However, in some cases the inplace version is slower than the allocating version.

This is my first package announcement, so any feedback is welcome :slightly_smiling_face:.

28 Likes

Nice package, if you want one day we can benchmark against GitHub - LAMPSPUC/StateSpaceModels.jl: StateSpaceModels.jl is a Julia package for time-series analysis using state-space models.

2 Likes

This is really interesting, thanks for writing this!

I wonder, did you consider calling the package KalmanFilters.jl (plural), since this is apparently what the naming guidelines suggest?

5 Likes

Nice. But if you are open to feedback, let me express that the very description of usage in README obviously assumes that readers are already fluent with this one particular “dialect”. You introduce the linear Kalman by writing

The linear Kalman Filter will be applied if you pass matrices F and H to the functions time_update and measurement_update respectively.

But what are these F and H matrices? You provide no details what their role is. Maybe in some (sub)communities these are called/labelled differently. It will certainly help if you explicitly show the model that these matrices parameterize. I am not calling for a tutorial on Kalman filtering, just setting the terminology and notation unambiguously. Perhaps have a look at the kalman entry in Matlab documentation.

5 Likes

Thank you for your feedback!
I have renamed the package from KalmanFilter.jl to the plural form KalmanFilters.jl. The new name is already merged into Julias registry.

I have also adjusted the Readme.md to clarify the variable names.

I have edited the original post to reflect these changes.

5 Likes

UPDATE: I have updated KalmanFilters.jl to version v0.1.2

KalmanFilters now supports complex valued inputs. So you can track complex valued states now =)

It now also supports vectors and matrices from StaticArrays. If you happen to have a small state space or only a small number of measurements, you could speed up the calculation using arrays from StaticArrays.

9 Likes