GPmp: the Gaussian process micro package
Project description
GPmp: the Gaussian process micro package
What is GPmp?
GPmp provides simple building blocks for GP-based algorithms. It is meant to be fast and easily customizable.
The user can choose between three backends to perform numerical computations: plain numpy, JAX or PyTorch. When JAX or PyTorch is used, GPmp relies on auto-differentiation to compute gradients. GPmp also uses JIT compilation features provided by JAX.
As core features, GPmp implements:
- GP interpolation and regression with known or unknown mean / intrinsinc kriging
- The standard Gaussian likelihood and the restricted likelihood of a model
- Leave-one-out predictions using fast cross-validation formulas
- Conditional sample paths
It is up to the user to write the mean and covariance functions for setting a GP model.
However, for the purpose of the example, GPmp provides functions for:
- anisotropic scaling
- distance matrix
- Matérn kernels with half-integer regularities
- parameter selection procedure using maximum likelihood, restricted maximum likelihood, or user-defined criteria
- model diagnosis
- vizualization of results
Note also that for the purpose of simplicity, the gpmp does not check the validity of arguments. This is left to the responsibility of the user / calling code.
Installation
Clone the git repository:
git clone https://github.com/gpmp-dev/gpmp.git
(or download a zip version)
Install in dev mode:
pip install -e .
Remarks:
-
It is recommended to run GPmp using PyTorch or JAX as a backend instead of Numpy.
-
Upon initialization, GPmp automatically detects if PyTorch is installed and sets the GPMP_BACKEND environment variable to 'torch' by default. If PyTorch is not found, it then searches for JAX and sets GPMP_BACKEND to 'jax'. If neither PyTorch nor JAX are detected, GPmp defaults to using Numpy, setting the GPMP_BACKEND environment variable to 'numpy'. Users have the option to manually override the chosen backend by setting the GPMP_BACKEND variable before launching GPmp.
-
JAX, which requires jaxlib, which is supported on Linux and macOS platforms, and on Windows via the Windows Subsystem for Linux. There is some initial native Windows support, but it is still somewhat immature (see below).
-
To install JAX with both CPU and NVidia GPU support, CUDA and CuDNN must be installed first. See https://github.com/google/jax#installation and https://jax.readthedocs.io/en/latest/changelog.html for details.
For instance, to install jaxlib with Cuda 11 and cudnn 8.2 or newer:
pip install jax[cuda11_cudnn82] -f https://storage.googleapis.com/jax-releases/jax_releases.html
- To install jaxlib on Windows, one can follow instructions at https://github.com/cloudhan/jax-windows-builder. Select and download a version of jaxlib from https://whls.blob.core.windows.net/unstable/index.html according to your Python version. Then install jax manually.
pip install <jaxlib_whl>
pip install jax
Usage
Please refer to the examples that illustrate the different features of GPmp.
Documentation with Sphinx
The automatic documentation is created using Sphinx and following the python docstrings recommendations from numpydoc
The html theme is taken from
pip install pydata_sphinx_theme
In order to generate the intereactive html:
cd ./doc
make html
To do
- write documentation
Authors
See AUTHORS.md
Copyright
Copyright (C) 2022-2024 CentraleSupelec
License
GPmp is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
GPmp is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with gpmp. If not, see http://www.gnu.org/licenses/.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gpmp-0.9.18.tar.gz
.
File metadata
- Download URL: gpmp-0.9.18.tar.gz
- Upload date:
- Size: 83.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e2a6bf270a59ab8d61632512f0f63c7bc6e4a5e651e70de2211f110cb569167 |
|
MD5 | 9f226f4dd8960c80ab9367abd834e89e |
|
BLAKE2b-256 | 148913ef627b688d209d7e1d1f74cb3f11c277ec7da0064ebcd968e813b5eb77 |
File details
Details for the file gpmp-0.9.18-py3-none-any.whl
.
File metadata
- Download URL: gpmp-0.9.18-py3-none-any.whl
- Upload date:
- Size: 84.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4325b00a80ff61925c389719e564a491ec6ae23e0b2e47fa423b4b98021f180 |
|
MD5 | 9dd2aec4ead126e05b69ac66d2d2de8a |
|
BLAKE2b-256 | a99ac2aad2941b2ae2c0662828dad15e15a26de79b005890973c8a3db0c77575 |