Adaptive Kalman Filter
This library ports an adaptive Kalman filter from FilterPy. There was an existing Kalman filter in Elixir however it’s a simple 1D implementation without adaptive gain, which I needed.
This version is implemented using Nx which allows it to also be multi-dimensional, to have increased performance, etc.
Adaptive gain allows the Kalman filter to adapt much quicker to external stimuli which aren’t modeled as part of process model. For example see the purple line below. The numbers in the graph legend are MSE of the total, first part, and second part. You can see the Adaptive Kalman (AKal) is much better at adjusting after a “jump”. Many data sources have this sort of non-continuous behavior due to system perturbations.
The hex package is at FilterEx. There’s also a simple Exponential filter as well.
Finally there’s a few useful Nx ports of NumPy/Scipy.linalg functions useful for this port such as zeros
, ravel
, and block_diag
in FilterEx.Utils.