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 objective, shows at least one plot, and then includes the
full script so that the example can be copied or run directly.
Example coverage¶
The selected examples cover the main GPmp operations:
1D interpolation gives the minimal sequence: model construction, covariance-parameter selection, prediction, and plotting.
2D interpolation, Higher-dimensional interpolation, and Higher-dimensional interpolation with Matérn regularity selection show the same operations when the input dimension is larger than one.
ML / REML / REMAP parameter selection compares ML, REML, and REMAP on one data set.
Dataloader-based parameter selection passes observations through
DatasetandDataLoaderobjects during parameter selection.Posterior parameter sampling uses reduced iteration counts in the documentation build. The code block shows the sampler arguments that control longer runs.
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 fixed-regularity Matérn examples, the covariance parameter
vector follows the sigma2_rho layout
The matern example uses the sigma2_nu_rho layout
The covariance kernel is written with a lowercase symbol \(k_\theta\). Covariance matrices and blocks are written with uppercase 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 |
|---|---|---|
Matérn covariance functions |
Compare half-integer and |
|
1D interpolation |
Build a noise-free GP interpolator, select covariance parameters, and plot the posterior. |
|
2D interpolation |
Build an anisotropic Matérn GP and inspect reference, prediction, error, and uncertainty fields. |
|
Higher-dimensional interpolation |
Use leave-one-out diagnostics when spatial plotting is no longer practical. |
|
Matérn regularity selection |
Higher-dimensional interpolation with Matérn regularity selection |
Select the Matérn regularity together with variance and lengthscales. |
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 functions.
Contents:
- Plotting Matérn covariances
- 1D interpolation
- 2D interpolation
- Higher-dimensional interpolation
- Higher-dimensional interpolation with Matérn regularity selection
- Custom covariance
- Noisy observations
- Conditional sample paths
- Noisy conditional sample paths
- ML / REML / REMAP parameter selection
- Posterior parameter sampling
- Dataloader-based parameter selection