time_varying_prior#

pymc_marketing.mmm.tvp.time_varying_prior(name, X, dims, X_mid=None, m=200, L=None, eta_lam=1, ls_mu=5, ls_sigma=5, cov_func=None)[source]#

Time varying prior, based on the Hilbert Space Gaussian Process (HSGP).

For more information see pymc.gp.HSGP.

Parameters:
namestr

Name of the prior and associated variables.

X1d array_like of int or float

Time points.

X_midint or float

Midpoint of the time points.

dimstuple of str or str

Dimensions of the prior. If a tuple, the first element is the name of the time dimension, and the second may be any other dimension, across which independent time varying priors for each coordinate are desired (e.g. channels).

mint

Number of basis functions.

Lint

Extent of basis functions. Set this to reflect the expected range of in+out-of-sample data (considering that time-indices are zero-centered). Default is X_mid * 2 (identical to c=2 in HSGP).

eta_lamfloat

Exponential prior for the variance.

ls_mufloat

Mean of the inverse gamma prior for the lengthscale.

ls_sigmafloat

Standard deviation of the inverse gamma prior for the lengthscale.

cov_funcpm.gp.cov.Covariance

Covariance function.

Returns:
pt.TensorVariable

Time-varying prior.

References

  • Ruitort-Mayol, G., and Anderson, M., and Solin, A., and Vehtari, A. (2022). Practical Hilbert Space Approximate Bayesian Gaussian Processes for Probabilistic Programming

  • Solin, A., Sarkka, S. (2019) Hilbert Space Methods for Reduced-Rank Gaussian Process Regression.