4

I am using the scikit-learn Python library to perform Bayesian optimization (on top of Gaussian process regression) on a function which takes seven inputs. Four of these inputs represent physical angles, so the Gaussian kernel should be periodic in them; a natural choice is sklearn.gaussian_process.kernels.ExpSineSquared. However, I do not want to arbitrarily force the function to be periodic in the other three.

According to The Kernel Cookbook, the proper way to do this is to simply multiply an ExpSineSquared kernel over the periodic variables with an aperiodic kernel (say the Matérn kernel) over the others and obtain something like

ExpSineSquared(x[:3])*Matern(x[3:])

(where x is the 7-vector of parameters). One would think that the Product kernel implemented in sklearn.gaussian_process.kernels would be the way to go, but as far as I can tell this would not allow me to choose which parameters are periodic and which are not; using the Product kernel would effectively give me ExpSineSquared(x)*Matern(x).

Since I'm not very experienced with GPR in sklearn, what is the best way to implement my desired kernel?

merv
  • 67,214
  • 13
  • 180
  • 245
mikefallopian
  • 221
  • 1
  • 7
  • 2
    I’m voting to close this question because it is not about programming as defined in the [help] but about ML theory & methodology. – desertnaut May 25 '21 at 20:18
  • 4
    @desertnaut I'm asking how to implement a specific form of a kernel to interface with the sklearn library, not what kind of kernel to use. Where else would I ask an implementation question, if not here? – mikefallopian May 25 '21 at 20:24

0 Answers0