GPy - Gaussian Process Toolbox

1.13.2 · active · verified Fri Apr 17

GPy is a Gaussian process (GP) framework written in Python, designed for flexible and robust GP modeling. It provides a comprehensive suite of tools for defining, manipulating, and optimizing Gaussian process models, including various kernels, likelihoods, and inference methods. The current version is 1.13.2, with releases occurring periodically, often tied to maintenance or feature additions rather than a strict schedule.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create a simple Gaussian Process regression model, define a kernel, fit it to some synthetic data, and optimize its hyperparameters using GPy. The example also shows how to print the optimized model parameters.

import GPy
import numpy as np

# 1. Generate some synthetic data
X = np.random.uniform(-3., 3., (20, 1))
Y = np.sin(X) + np.random.randn(20, 1) * 0.05

# 2. Define a kernel (e.g., Radial Basis Function)
kernel = GPy.kern.RBF(input_dim=1, variance=1., lengthscale=1.)

# 3. Create a GP regression model
m = GPy.models.GPRegression(X, Y, kernel)

# 4. Optimize the model's hyperparameters
m.optimize(messages=True, max_iters=100)

# Print optimized parameters
print(m)

# To plot (requires matplotlib):
# import matplotlib.pyplot as plt
# m.plot()
# plt.show()

view raw JSON →