Skip to content

gpmp-dev/gpmp

Repository files navigation

GPmp logo

GPmp: Gaussian Process micro package

Python PyPI License Documentation Docs build

Website and documentation | Examples | API reference | PyPI | gpmp-contrib

GPmp is a focused, lightweight, research-grade Python package for exact Gaussian-process modeling in kriging and computer experiments. It provides essential components for GP-based algorithms, with emphasis on performance, customization, transparent parameter selection (ML/REML/REMAP), diagnostics, and posterior sampling (MH/NUTS/SMC).

GPmp follows a small-API philosophy: do exact GP modeling explicitly, expose the modeling choices, and keep the code easy to inspect, modify, and embed in algorithms or scientific software. Compared with larger GP frameworks, GPmp favors explicit control of modeling choices and robust behavior in practical GP analyses.

Numerical computations use gpmp.num, with NumPy and PyTorch backends.

When to use GPmp

Use gpmp when you need an explicit GP core for kriging, parameter selection, diagnostics, posterior sampling, conditional simulation, plotting, data utilities, or integration inside another algorithm.

Use gpmp-contrib when you want complete computer-experiment procedures, Bayesian optimization algorithms, excursion-set estimation, set inversion, and related sequential-design utilities.

Use a larger GP framework when you primarily need broad model families, large-scale approximate inference, or a complete probabilistic programming interface.

Core features

  • Exact GP interpolation and regression: zero, parameterized, and linear-predictor means, including intrinsic and universal kriging settings.
  • Covariance functions: Matérn covariance helpers, anisotropic scaling, distance matrices, and user-defined covariance functions.
  • Parameter selection: ML, REML, REMAP, user-defined criteria, bounds, and SciPy optimizer access.
  • Diagnostics: leave-one-out quantities, prediction-performance summaries, parameter reports, and selection-criterion cross sections.
  • Posterior covariance-parameter sampling: adaptive Metropolis-Hastings, NUTS, and tempered Sequential Monte Carlo.
  • Conditional simulation: conditional sample paths for GP models.
  • Data utilities: random designs, splits, cross-validation helpers, and dataloaders for batched criterion evaluation.
  • Plotting helpers: compact plotting utilities for GP predictions, diagnostics, and examples.
  • Backend objects: NumPy and PyTorch numerical backends through gpmp.num.

Numerical backends

GPmp supports two numerical backends:

  • NumPy: default backend when PyTorch is unavailable, and often fast for many small-to-medium exact GP computations.
  • PyTorch: enables automatic differentiation and is useful when gradient information is needed, especially in higher-dimensional parameter settings.

Backend selection order at import time:

  1. If GPMP_BACKEND is set to torch or numpy, use it.
  2. Otherwise, use PyTorch if available, then NumPy.
export GPMP_BACKEND=torch
export GPMP_DTYPE=float64

Package split

gpmp
  core model
  kernels
  parameter objects
  parameter selection
  diagnostics
  posterior samplers
  plotting helpers

gpmp-contrib
  model containers
  computer experiments
  Bayesian optimization algorithms
  expected improvement
  excursion-set estimation
  set inversion
  reGP utilities

Install

pip install gpmp
python -c "print(__import__('gpmp').__version__)"

The verification command prints the installed GPmp version.

For local development:

git clone https://github.com/gpmp-dev/gpmp.git
cd gpmp
pip install -e .

Use pip install -e ".[dev]" for development tools, or pip install -e ".[docs]" for documentation tools.

Install the companion package when you need complete computer-experiment procedures:

pip install gpmp-contrib

GPmp depends on NumPy, SciPy, and Matplotlib. PyTorch is optional. Install it when automatic differentiation is needed. For GPU-enabled PyTorch, use the official PyTorch installation selector to choose the build matching the local CUDA setup.

Documentation

The documentation is available at https://gpmp-dev.github.io/gpmp/.

To build it locally:

cd docs
make html

Public API

The intended public API is organized around:

  • gpmp.core
  • gpmp.kernel
  • gpmp.parameter
  • gpmp.modeldiagnosis
  • gpmp.mcmc
  • gpmp.plot
  • gpmp.num

How to cite

If you use GPmp in research, please cite:

@software{gpmp2026,
  author       = {Emmanuel Vazquez},
  title        = {GPmp: Gaussian Process micro package},
  year         = {2026},
  url          = {https://github.com/gpmp-dev/gpmp},
  note         = {Version 0.9.37},
}

Update the version number when citing another release.

Minimal example

The basic sequence is: define mean and covariance functions, build a model, select covariance parameters, predict, and diagnose the result.

GPmp keeps model construction explicit: users provide the mean function and the covariance function.

import gpmp as gp
import gpmp.num as gnp


def mean(x, param):
    return gnp.ones((x.shape[0], 1))


def covariance(x, y, covparam, pairwise=False):
    p = 3  # Matern regularity p + 1/2
    return gp.kernel.maternp_covariance(x, y, p, covparam, pairwise)


xt = gp.misc.designs.regulargrid(1, 200, [[-1.0], [1.0]])
zt = gp.misc.testfunctions.twobumps(xt)
xi = gp.misc.designs.ldrandunif(1, 6, [[-1.0], [1.0]])
zi = gp.misc.testfunctions.twobumps(xi)

model = gp.Model(mean, covariance)
model, info = gp.kernel.select_parameters_with_reml(model, xi, zi, info=True)
zpm, zpv = model.predict(xi, zi, xt)

gp.modeldiagnosis.diag(model, info, xi, zi)

The final line prints parameter-selection diagnostics. The rendered documentation page shows the corresponding interpolation plot: 1D interpolation example.

Authors

See AUTHORS.md for details.

License

GPmp is free software released under the GNU General Public License v3.0. See LICENSE for details.

Packages

 
 
 

Contributors

Languages