pymc.gp.approx_hsgp_hyperparams#

pymc.gp.approx_hsgp_hyperparams(x_range, lengthscale_range, cov_func)[source]#

Use heuristics to recommend minimum m and c values, based on recommendations from Ruitort-Mayol et. al.

In practice, you need to choose c large enough to handle the largest lengthscales, and m large enough to accommodate the smallest lengthscales. Use your prior on the lengthscale as guidance for setting the prior range. For example, if you believe that 95% of the prior mass of the lengthscale is between 1 and 5, set the lengthscale_range to be [1, 5], or maybe a touch wider.

Also, be sure to pass in an x_range that is exemplary of the domain not just of your training data, but also where you intend to make predictions. For instance, if your training x values are from [0, 10], and you intend to predict from [7, 15], the narrowest x_range you should pass in would be x_range = [0, 15].

NB: These recommendations are based on a one-dimensional GP.

Parameters:
x_rangelist[float]

The range of the x values you intend to both train and predict over. Should be a list with two elements, [x_min, x_max].

lengthscale_rangeList[float]

The range of the lengthscales. Should be a list with two elements, [lengthscale_min, lengthscale_max].

cov_funcstr

The covariance function to use. Supported options are “expquad”, “matern52”, and “matern32”.

Returns:
- `m`int

Number of basis vectors. Increasing it helps approximate smaller lengthscales, but increases computational cost.

- `c`float

Scaling factor such that L = c * S, where L is the boundary of the approximation. Increasing it helps approximate larger lengthscales, but may require increasing m.

Raises:
ValueError

If either x_range or lengthscale_range is not in the correct order.

References

  • Riutort-Mayol, G., Anderson, M., Solin, A., Vehtari, A. (2022).

Practical Hilbert Space Approximate Bayesian Gaussian Processes for Probabilistic Programming