Implementing Gaussian Process with Periodic Kernel in PyMC: Questions and Approaches

Hello everyone,

I’m attempting to use PyMC to implement a Gaussian Process. My goal is to model the baseline and seasonality of a marketing mix model (MMM). Specifically, I’d like to use a periodic kernel along with a Matern/ExpQuad kernel.

After reading your documentation, I understand that I can’t use the HSGP class with a periodic kernel. Therefore, the only way to implement the described kernel would be to use the Latent class, which, however, requires enormous computational times.

I have some questions regarding this:

  • Is the reasoning I’ve outlined above correct?
  • Is there a way to achieve the above but with an approximate method?
  • Once the Gaussian process is “trained,” is there an easy way to use it for making predictions? I know about gp.conditional, but are there any alternatives?
  • Does it make sense to use a Gaussian process for out-of-sample predictions?

Thanks in advance.

You’re correct about Latent possibly being too slow. Take a look at the pm.gp.HSGPPeriodic class, I think it’s what you need.

It does make sense to use a GP for out of sample predictions. Check the docstring for HSGP and HSGPPeriodic for instructions on using pm.set_data to make predictions, bypassing gp.conditional.

Hope that helps, please ask again if you have any more questions.

1 Like

On top of Bill’s input, here is a concrete example to generate out of sample predictions with the HSGP class A Conceptual and Practical Introduction to Hilbert Space GPs Approximation Methods - Dr. Juan Camilo Orduz (go to the end to skip the theoretical details)

1 Like