Registry / ai-ml / gpflow

gpflow

JSON →
library2.10.0pypypi✓ verified 83d ago

GPflow is a Gaussian process library in TensorFlow, designed for GP regression and advanced GP models. It provides a flexible, composable framework for building and training GP models using TensorFlow's automatic differentiation. Current version 2.10.0 targets TensorFlow 2.x and has a moderate release cadence (major/minor roughly every few months).

pip install gpflow
INSTALL
IMPORT
SIG · GPFLOW
G
gpflow
ai-mlpythonv2.10.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

gpflow.kernels
from gpflow import kernels
import gpflow.kernels
In GPflow 2.x, submodules are not automatically imported; use `from gpflow import kernels` or import explicitly.
GPR
from gpflow.models import GPR
SVGP
from gpflow.models import SVGP

Basic GP regression with GPflow: create data, build GPR model with SquaredExponential kernel, optimise hyperparameters, and predict.

import gpflow import numpy as np import tensorflow as tf # Create synthetic data X = np.random.randn(20, 1) Y = np.sin(X) + 0.1 * np.random.randn(20, 1) # Build model k = gpflow.kernels.SquaredExponential() m = gpflow.models.GPR(data=(X, Y), kernel=k, noise_variance=1.0) # Optimise opt = gpflow.optimizers.Scipy() opt.minimize(m.training_loss, m.trainable_variables) # Predict Xtest = np.linspace(-3, 3, 100)[:, None] mean, var = m.predict_f(Xtest) print("Predictions:", mean.numpy().flatten()[:5])
Debug
Known issues
breakingGPflow 2.x is a major rewrite with breaking changes from 1.x. The API, module structure, and TensorFlow version requirements (TF 2.x) are different. Models built for GPflow 1.x will not work without modification.
fix
Migrate code: use `from gpflow import ...` (not `import gpflow as gp` submodules), replace `gpflow.kernels.RBF` with `gpflow.kernels.SquaredExponential`, and update to TF 2.x.
affects: 1.x -> 2.0+
deprecatedGPflow 2.10.0 still supports TensorFlow 2.x, but future versions may require TensorFlow 2.10+ or higher. Check compatibility matrix.
fix
Keep TensorFlow updated and pin versions if needed.
affects: >=2.0
gotchaWhen using `gpflow.models.GPR` (or other models), the training loss is a TensorFlow tensor, not a scalar. Use `.numpy()` to get a Python float if needed.
fix
Call `m.training_loss.numpy()` to get the value as a float.
affects: >=2.0
Errors
Common errors & fixes
AttributeError: module 'gpflow' has no attribute 'kernels'
GPflow 2.x lazy-loads submodules; you must import them explicitly.
fix
Use `from gpflow import kernels` instead of `import gpflow.kernels`.
TypeError: Expected float64, got float32
GPflow defaults to float64; TensorFlow may produce float32 from default settings.
fix
Cast input data: `tf.cast(X, tf.float64)` or set global default to float64.
Upgrade
Version history
2.10.0latest on PyPI · released May 29, 2025
Audit
Dependencies
tensorflowrequiredCore backend for GPflow; must be installed separately (TF 2.x).
tensorflow-probabilityoptionalOptional but recommended for certain models and utilities.
Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
gpflow — pip install gpflow · libregistry