Relaxed Gaussian processes

The regp module implements relaxed Gaussian-process utilities for threshold-oriented modeling. It is typically used when observations in a target region are relaxed and jointly optimized with covariance parameters before prediction.

Function contracts

get_membership_indices(zi, R)

Assign observations to relaxation intervals. zi has shape (n,) or (n, 1). R is a list of intervals [lower, upper]. Returns an integer NumPy array with shape (n,). Value 0 means that the observation is outside all relaxation intervals. Positive values identify the interval index starting at 1.

split_data(xi, zi, ei, R)

Split observations according to membership indices. Returns (x0, z0, ind0) for non-relaxed rows and (x1, z1, bounds, ind1) for relaxed rows. bounds contains the interval bounds associated with each relaxed observation.

make_regp_criterion_with_gradient(model, x0, z0, x1)

Build a differentiable reGP criterion for SciPy optimization. Returns (crit_pre_grad, dcrit). The first callable evaluates the objective and caches the gradient graph. The second callable returns the gradient for the same parameter vector.

remodel(model, xi, zi, R, covparam0=None, info=False, verbosity=0, convert_in=True, convert_out=True)

Optimize covariance parameters and relaxed observation values. xi has shape (n, d) and zi has shape (n,) or (n, 1). If covparam0 is None, the function computes an anisotropic initial guess. Returns (model, zi_relaxed, ind_relaxed). With info=True, returns (model, zi_relaxed, ind_relaxed, info_ret).

The supplied model is modified in place through its covparam field.

predict(model, xi, zi, xt, R, covparam0=None, info=False, verbosity=0)

Run remodel and predict at xt. Returns (zi_relaxed, (zpm, zpv), model, info_ret). info_ret is None when info=False.

select_optimal_threshold_above_t0(model, xi, zi, t0, G=20)

Evaluate G thresholds above t0 and return the interval [[threshold, inf]] with the smallest tCRPS criterion.

Relaxed Gaussian process (reGP) utilities for threshold-oriented modeling.

This module implements the reGP procedure used in examples/example20_regp.py: start from an initial GP model, relax observations in a target interval, and update the covariance parameters jointly with relaxed values to improve behavior in a region of interest.

Typical use

  1. Define a relaxation interval R (for example [[u, +inf]]).

  2. Call predict(…) (or remodel(…)) to obtain relaxed observations and posterior predictions.

  3. Optionally call select_optimal_threshold_above_t0(…) to choose a threshold above t0 with a tCRPS-based criterion.

Defines

get_membership_indices

Assign each observation to a relaxation interval index.

split_data

Split observations into non-relaxed and relaxed subsets.

make_regp_criterion_with_gradient

Build the reGP objective and gradient wrappers for optimization.

remodel

Perform reGP parameter/value optimization (REML + relaxation).

predict

Run reGP remodeling then compute posterior predictions.

select_optimal_threshold_above_t0

Select a relaxation threshold above t0 by minimizing a tCRPS criterion.

Reference

S. J. Petit, J. Bect, and E. Vazquez (2025). “Relaxed Gaussian Process Interpolation: a Goal-Oriented Approach to Bayesian Optimization.” Journal of Machine Learning Research, 26(195):1-70. https://www.jmlr.org/papers/v26/22-0828.html

gpmpcontrib.regp.regp.get_membership_indices(zi, R)[source]

Get the index of the membership of each row in zi to an interval in R.

Parameters:
  • zi (ndarray) – An (n, 1) shaped array of data points.

  • R (list of lists) – A list of intervals represented as [l_i, u_i] pairs.

Returns:

ei – An (n, 1) shaped array of membership indices.

Return type:

ndarray

gpmpcontrib.regp.regp.make_regp_criterion_with_gradient(model, x0, z0, x1)[source]

Make regp criterion function with gradient.

Parameters:
  • model (gpmp model) – Gaussian process model.

  • x0 (ndarray, shape (n0, d)) – Locations of the observed data points not relaxed

  • z0 (ndarray, shape (n0,)) – Observed values at the data points not relaxed

  • x1 (ndarray, shape (n1, d)) – Locations of the relaxed data points

Returns:

  • crit_pre_grad (callable) – Criterion wrapper to evaluate objective and cache graph before gradient.

  • dcrit (callable) – Gradient function compatible with SciPy’s jac callback.

gpmpcontrib.regp.regp.predict(model, xi, zi, xt, R, covparam0=None, info=False, verbosity=0)[source]

Perform reGP optimization (REML + relaxation) and prediction

Parameters:
  • model (GPModel) – Gaussian process model.

  • xi (ndarray, shape (n, d)) – Locations of the observed data points.

  • zi (ndarray, shape (n,)) – Observed values at the data points.

  • xt (ndarray, shape (n, d)) – Locations of points to be predicted.

  • R (list of intervals) – List of relaxation intervals, each specified as [l_k, u_k].

  • covparam0 (ndarray, optional) – Initial guess for the covariance parameters.

  • info (bool, optional) – Whether to return additional information.

  • verbosity (int, optional) – Verbosity level.

Returns:

  • zi_relaxed (ndarray, shape (n,)) – Relaxed output data.

  • (zpm, zpv) (tuple of ndarrays) – Relaxed posterior mean and variance.

  • model (GPmp model) – Updated GPmp Gaussian process model.

  • info_ret (dict, optional) – Additional information (if info=True).

gpmpcontrib.regp.regp.remodel(model, xi, zi, R, covparam0=None, info=False, verbosity=0, convert_in=True, convert_out=True)[source]

Perform reGP optimization (REML + relaxation)

Parameters:
  • model (GPModel) – Gaussian process model.

  • xi (ndarray, shape (n, d)) – Locations of the observed data points.

  • zi (ndarray, shape (n,)) – Observed values at the data points.

  • R (list of intervals) – List of relaxation intervals, each specified as [l_k, u_k].

  • covparam0 (ndarray, optional) – Initial guess for the covariance parameters.

  • info (bool, optional) – Whether to return additional information.

  • verbosity (int, optional) – Verbosity level.

  • convert_in (bool, optional) – Whether to convert input arrays to _gpmp_backend_ type or keep as-is.

  • convert_out (bool, optional) – Whether to return numpy arrays or keep _gpmp_backend_ types.

Returns:

  • model (GPmp model) – Updated GPmp Gaussian process model.

  • zi_relaxed (ndarray, shape (n,)) – Relaxed output data.

  • ind_relaxed (ndarray) – Indices of the relaxed data points in the input zi array.

  • info_ret (dict, optional) – Additional information (if info=True).

gpmpcontrib.regp.regp.select_optimal_threshold_above_t0(model, xi, zi, t0, G=20)[source]

Choose threshold for reGP with relaxation above t0

This function selects an optimal threshold for a reGP above t0 by minimizing the truncated continuous ranked probability score (tCRPS) over a range of possible thresholds.

Parameters:
  • model (GPModel) – Gaussian process model.

  • xi (ndarray, shape (n, d)) – Locations of the observed data points.

  • zi (ndarray, shape (n,)) – Observed values at the data points.

  • t0 (float) – Lower limit of the threshold range.

  • G (int, optional, default: 20) – Number of candidate thresholds to evaluate.

Returns:

Rgopt – Optimal relaxation interval, specified as [threshold, inf].

Return type:

ndarray, shape (1, 2)

gpmpcontrib.regp.regp.split_data(xi, zi, ei, R)[source]

Split the data based on the membership indices.

Parameters:
  • xi (ndarray) – An (n, d) shaped array of data points.

  • zi (ndarray) – An (n, 1) shaped array of data points.

  • ei (ndarray) – An (n, 1) shaped array of membership indices.

  • R (list of intervals) – List of intervals, each specified as [l_k, u_k].

Returns:

  • (x0, z0, ind0) (tuple of ndarrays) – A tuple of (n0, d), (n0, 1) shaped arrays for xi and zi rows with ei = 0, and the corresponding indices.

  • (x1, z1, bounds, ind1) (tuple of ndarrays) – Rows of xi and zi with ei > 0, and the corresponding interval bounds and indices.