easykf-2.04
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
Kalman Filters

Introduction

Two algorithms are implemented and all of them taken from the PhD of Van Der Merwe "Sigma-Point Kalman Filters for Probabilistic Inference in Dynamic State-Space Models" :

Usage

To use the library, you simply need to :

UKF for parameter estimation

For UKF for parameter estimation, two versions are implemented : in case of a scalar output or vectorial output. The vectorial version works also in the scalar case but is more expensive (memory and time) than the scalar version when the output is scalar.
For the scalar version :

Examples using the scalar version :

For the vectorial version :

Examples using the vectorial version :

Joint UKF

The Joint UKF tries to estimate both the state and the parameters of a system. The structures/methods related to Joint UKF are :

Installation and running

Requirements:

In addition to a g++ compiler with the standard libraries, you also need to install :

Compilation, Installation

The installation follows the standard, for example on Linux : mkdir build cd build cmake .. -G"Unix Makefiles" -DCMAKE_INSTALL_PREFIX=<the prefix="" where="" you="" want="" the="" files="" to="" be="" installed>=""> make make install

It will compile the library, the examples, the documentation and install them.

Example outputs

Example 1 : Learning XOR with a 2-2-1 MLP

Running (maybe several times if falling on a local minima) example-001-xor, you should get the following classification :

example-001.png
XOR classification

An example set of learned parameters is :

x[0] – (9.89157) –> y[0]
x[1] – (4.18644) –> y[0]
Bias y[0] : 8.22042

x[0] – (10.7715) –> y[1]
x[1] – (4.18047) –> y[1]
Bias y[1] : -8.70185

y[0] – (6.9837) –> z
y[1] – (-6.83324) –> z
Bias z : -3.89682

The transfer function is a sigmoid : $ f(x) = \frac{2}{1 + exp(-x)}-1$

Example 2 : Learning the extended XOR with a 2-12-1 MLP and a parametrized transfer function

Here we use a 2-12-1 MLP, with a sigmoidal transfer function, to learn the extended XOR problem. The transfer function has the shape : $f(x) = \frac{1}{1.0 + exp(-x)}$

The classification should look like this :

example-002.png
Extended XOR classification

Example 3 : Approximating the sinc function with a Radial Basis Function network

In this example, we use a RBF network with 10 kernels to approximate the sinc function on [-5.0,5.0] To make the life easier for the algorithm, we evenly spread the centers of the gaussians on [-5.0, 5.0].

The results are saved in 'example-003.data', the first column contains the x-position, the second column the result given by the trained RBF and the last column the value of sinc(x)

example-003.png
RBF learning the sinc function

Example 4 : Using a 2-2-3 MLP to learn three boolean functions : XOR, AND, OR

Example 5 : Using a 2-12-2 MLP to learn the Mackay-robot arm problem

In this example, we learn the two outputs (x,y) from the inputs (theta, phi) of the Mackay-robot arm dataset. For this we train a 2-12-2 MLP with a parametrized sigmoidal transfer function.

example-005-x.png
Learning the x-component
example-005-y.png
Learning the y-component

Example 6 : Finding the minimum of the Rosenbrock banana function

We use here UKF for parameter estimation to find the minimum of the Rosenbrock banana function : $ f(x,y) = (1 - x)^2 + 100 ( y - x^2)^2 $

example-006.png
Minimisation of the Rosenbrock banana function

Example 7 : Finding the parameters of a Lorentz attractor

In this example, we try to find the parameters (initial condition, evolution parameters) of a noisy lorentz attractor. The dynamic of the lorentz attractor is defined by the three equations :

$ \frac{dx}{dt} = \sigma ( y - x ) $
$ \frac{dy}{dt} = x (\rho - z) - y $
$ \frac{dz}{dt} = xy - \beta z $
While observing a noisy trajectory of such a Lorentz attractor, the algorithm tries to find the current state and the evolution parameters $ (\sigma, \rho, \beta)$. The samples we provide are $ (t_i, {x(t_i), y(t_i), z(t_i)})$.

To clearly see how UKF catches the true state, we initialized the estimated state of UKF to -15, -15 , -15

example-007-rms.png
Learning RMS
example-007.png
Estimated state with the true state and its noisy observation