Abstract types and methods for Gaussian Processes.
AbstractGPs.jl is a package that defines a low-level API for working with Gaussian processes (GPs), and basic functionality for working with them in the simplest cases. As such it is aimed more at developers and researchers who are interested in using it as a building block than end-users of GPs. You may want to go through the main API design documentation.
AbstractGPs is an officially registered Julia package, so the following will install AbstractGPs using the Julia's package manager:
] add AbstractGPs
# Import packages.
using AbstractGPs, Plots
# Generate toy synthetic data.
x = rand(10)
y = sin.(x)
# Define GP prior with Matern-3/2 kernel
f = GP(Matern32Kernel())
# Finite projection of `f` at inputs `x`.
# Added Gaussian noise with variance 0.001.
fx = f(x, 0.001)
# Log marginal probability of `y` under `f` at `x`.
# Quantity typically maximised to train hyperparameters.
logpdf(fx, y)
# Exact posterior given `y`. This is another GP.
p_fx = posterior(fx, y)
# Log marginal posterior predictive probability.
logpdf(p_fx(x), y)
# Plot posterior.
scatter(x, y; label="Data")
plot!(-0.5:0.001:1.5, p_fx; label="Posterior")
If you notice a problem or would like to contribute by adding more kernel functions or features please submit an issue.