Examples¶
The repository contains runnable scripts in the examples/ directory. The
pages below are rendered from a selected subset of those scripts. Each page
states the modeling objective, shows at least one plot, and then includes the
full script so that the example can be copied or run directly.
How to use these examples¶
Start with 1D interpolation if you want the minimal GPmp sequence: construct a model, select covariance parameters, predict, and plot. Move to 2D interpolation or Higher-dimensional interpolation for multidimensional problems. Use ML / REML / REMAP parameter selection when the main question is how ML, REML, and REMAP differ. Use Dataloader-based parameter selection when observations are organized through batching utilities.
The rendered previews are intentionally shorter than some scripts. Expensive sections, such as long posterior sampling loops, may be discussed but not fully executed during the documentation build. The literal script included on each page remains the reference implementation.
Notation used below¶
The example pages use the same names as the scripts. Observation points are
stored in xi and written mathematically as \(x_i\). Prediction points
are stored in xt and written as \(x_t\).
The latent process is denoted by \(Z\). A typical model is
where \(m\) is the mean function and \(k_\theta\) is the covariance kernel. In the Matern examples, the covariance parameter vector follows the GPmp convention
The covariance blocks are written with lowercase symbols. For example, \(k_{ii}\) is the matrix with entries \(k_\theta(x_i^a, x_i^b)\), and \(k_{it}\) contains the covariances between observation points and prediction points.
Random variables use uppercase letters. Thus \(Z_i = Z(x_i)\) and
\(Z_t = Z(x_t)\) are random variables. The arrays zi and zt store
realizations, denoted by lowercase \(z_i\) and \(z_t\).
Selected examples¶
Topic |
Page |
What it illustrates |
|---|---|---|
Matern covariance functions |
Compare half-integer Matern kernels and their smoothness behavior. |
|
1D interpolation |
Build a noise-free GP model, select covariance parameters, and plot the posterior. |
|
2D interpolation |
Build an anisotropic Matern model and inspect reference, prediction, error, and uncertainty fields. |
|
Higher-dimensional interpolation |
Use leave-one-out diagnostics when spatial plotting is no longer practical. |
|
Custom covariance |
Define and use a covariance callable with the GPmp model interface. |
|
Noisy observations |
Model noisy observations while predicting the latent process. |
|
Conditional sample paths |
Generate posterior sample paths in the noise-free setting. |
|
Noisy conditional sample paths |
Generate conditional paths when observations have heteroscedastic noise. |
|
ML / REML / REMAP comparison |
Compare parameter-selection criteria on the same one-dimensional setup. |
|
Posterior parameter sampling |
Start from REMAP selection and explore covariance-parameter uncertainty. |
|
Dataloader-based selection |
Use |
Running examples locally¶
Run an example from the repository root, for instance:
python examples/gpmp_example02_1d_interpolation.py
When writing new examples, prefer the same structure: define data generation, define the model, select covariance parameters, run prediction or diagnostics, and keep plotting in small helper functions.
Contents: