Skip to content

Latest commit

 

History

79 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RecursiveGPs.jl

Stable Dev CI

RecursiveGPs.jl implements recursive Gaussian process (RGP) regression (Huber, 2014) for learning unknown functions online. The package depends on AbstractGPs.jl for kernel definitions and LowLevelParticleFilters.jl for the Kalman Filter backend.

An RGP approximates a Gaussian process by its values at a fixed set of basis points. These values form the state of a Kalman filter, which is updated with each observation at a constant cost. Past observations are not stored, and the posterior mean and variance of the function are available at every step.

The GP state can be augmented with the states of a physical model. An extended Kalman filter then estimates the model states and an unknown function in the model, for example a friction law or the open-circuit voltage curve of a battery, from the same measurements.

Installation

To install RecursiveGPs.jl, use the Julia package manager:

using Pkg
Pkg.add("RecursiveGPs")

Example

Learn a function from noisy samples, one sample at a time:

using RecursiveGPs, AbstractGPs, StaticArrays

# Noisy samples of a function to learn
f(u) = 0.5u + 0.1 * sinpi(2u)
us = 0.1 .+ 0.7 .* rand(100)
ys = [SA[f(u) + 0.005 * randn()] for u in us]

# GP prior, represented at 21 basis points
rgp = RGP(0.1 * with_lengthscale(SEKernel(), 0.4), collect(range(0, 1, length = 21)))

# Kalman filter whose state is the GP at the basis points
kf = ExtendedKalmanFilter(rgp; σn = 0.005)

# Learn online
for (u, y) in zip(us, ys)
    kf(u, y)
end

# Posterior mean and covariance of f
post = predict_gp(kf, range(0, 1, length = 200))

Models with several GPs or with physical states use the multi-component constructor, ExtendedKalmanFilter(components, dynamics, measurement, R2), with arbitrary dynamics and measurement functions.

Documentation

The documentation contains a theoretical introduction to GP regression and the recursive GP, and the following tutorials:

License

MIT, see LICENSE.

About

Online Gaussian process regression with Kalman filters

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages