I'm using the scikit-learn's implementation of Gaussian processes. A simple thing to do is to combine multiple kernels as a linear combination to describe your time series properly. So I'd like to include both the squared exponential kernel and the periodic kernel. Linear combinations of valid kernels produce valid kernels, and same goes for multiplying valid kernels (given by Rasmussen and Williams).
Unfortunately I haven't figured out how to give the theta parameters properly to the model. For example, if we have:
$$
k_{Gauss}(x,x') = \exp{(\theta (x-x')^2)}
$$
then it is alright (this is how the squared-exponential kernel is defined in scikit-learn). But if I wanted:
$$
k_{Gauss}(x,x') = \theta_0 \exp{(\theta_1 (x-x')^2)}
$$
then it is impossible, it seems. The $\mathbf{\theta}$ thing is supposed to be an array, in case you have multiple dimensions/features (even though scikit-learn doesn't support multidimensional GPs, someone developed it, and it will be merged soon). So there is one row with the columns being the parameter in such-and-such dimension. But you cannot have more rows, otherwise it screams at you.
So question: has anyone actually been able to use kernels that use more than one hyperparameter? If so, what am I doing wrong? And if it is indeed not possible with the current code in scikit, does anyone have some tips on how to extend it so that it can? This is a really important feature that I need. Thanks.
Best Answer
On scikit-learn==0.14.1.
$\theta_0$ can be a vector. The following code works for me.
You can pass any kernel you want as the parameter corr. The following is the radial basis function that sklearn uses for Gaussian processes.
It looks like you're doing something pretty interesting, btw.