approx_hsgp_hyperparams#

pymc_marketing.mmm.hsgp.approx_hsgp_hyperparams(x, x_center, lengthscale_range, cov_func)[source]#

Use heuristics for 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.

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

Parameters:
xtensor_like

The x values the HSGP will be evaluated over.

x_centertensor_like

The center of the data.

lengthscale_rangetuple[float, float]

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

cov_funcLiteral[“expquad”, “matern32”, “matern52”]

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

[1]

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

Practical Hilbert Space Approximate Bayesian Gaussian Processes for Probabilistic Programming