Skip to content

timweiland/FunctionalGPs.jl

Repository files navigation

FunctionalGPs.jl

FunctionalGPs.jl
Mix & match point observations, derivatives and integrals for Gaussian process regression in Julia

Stable Docs Dev Docs
Build Status codecov code style: runic

Warning

Alpha release. FunctionalGPs.jl is under active development. The public API is not yet stable: function names, type signatures, and module layout may change without notice between releases, and there are still rough edges. Pin a specific version if you need reproducibility, and please file an issue if something breaks for you — feedback at this stage is very welcome.

What is FunctionalGPs.jl?

FunctionalGPs.jl extends AbstractGPs.jl with a composable algebra of linear functionals on Gaussian processes. You can condition a GP on, and predict, any linear transform of the latent function:

  • Point evaluations (regression as usual)
  • Partial derivatives of any order (gradient / Hessian observations)
  • Lebesgue integrals over intervals and boxes (Bayesian quadrature, cell averages)
  • Sums, scales, tensor products, and stacks of all of the above

The functional algebra dispatches into specialised assembly paths — Toeplitz matrices for stationary kernels on regular grids, sparse matrices for compactly supported (Wendland) kernels, closed-form antiderivatives where available — so you can build mixed-observation models without paying a hand-tuned-code tax.

Installation

FunctionalGPs.jl is registered in the Julia General registry:

using Pkg
Pkg.add("FunctionalGPs")

Quick start

using FunctionalGPs
using AbstractGPs

k = WendlandKernel(1, 2, 1.0)
f = GP(k)

# Condition on point observations
f1 = condition_on_observation(f, [0.0, 1.0], [0.0, 0.84]; noise = 1.0e-8)

# Further condition on a derivative observation at x = 0.5
∂x = PartialDerivative((1,))
ℒ = EvaluationFunctional([0.5])  ∂x
f2 = condition_on_observation(f1, ℒ, [1.0]; noise = 1.0e-8)

Joint functional Gaussians

For Turing / DynamicPPL models that need to bundle several functionals of the same GP and preserve their cross-covariances, use FunctionalGaussian:

using FunctionalGPs, FunctionalGPs.Notation

fg = FunctionalGaussian(f;
    y  = δ(X_obs),
    dy = δ(X_pred)  (1),
    q  = ([Interval(0.0, 1.0)]),
)

s    = rand(fg)             # joint prior draw as a NamedTuple (; y, dy, q)= loglikelihood(fg, (; y = y_obs); noise = (; y = σ²))
post = posterior(fg,    (; y = y_obs); noise = (; y = σ²))
post.dy   # LazyMvNormal over derivative locations
post.q    # LazyMvNormal over the integral

See the documentation for the full API, more examples, and the trait-based kernel specialisation system.

Related packages

License

MIT.

About

Mix & match point observations, derivatives and integrals for Gaussian process regression in Julia

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors