Exp-Sine-Squared kernel (aka periodic kernel).
The ExpSineSquared kernel allows one to model functions which repeat themselves exactly. It is parameterized by a length scale parameter :math:`l>0` and a periodicity parameter :math:`p>0`. Only the isotropic variant where :math:`l` is a scalar is supported at the moment. The kernel is given by:
.. math:: k(x_i, x_j) = \textxp\left(- \frac 2\sin^2(\pi d(x_i, x_j)/p)
l^ 2
\right)
where :math:`l` is the length scale of the kernel, :math:`p` the periodicity of the kernel and :math:`d(\\cdot,\\cdot)` is the Euclidean distance.
Read more in the :ref:`User Guide <gp_kernels>`.
.. versionadded:: 0.18
Parameters ----------
length_scale : float > 0, default=1.0 The length scale of the kernel.
periodicity : float > 0, default=1.0 The periodicity of the kernel.
length_scale_bounds : pair of floats >= 0 or 'fixed', default=(1e-5, 1e5) The lower and upper bound on 'length_scale'. If set to 'fixed', 'length_scale' cannot be changed during hyperparameter tuning.
periodicity_bounds : pair of floats >= 0 or 'fixed', default=(1e-5, 1e5) The lower and upper bound on 'periodicity'. If set to 'fixed', 'periodicity' cannot be changed during hyperparameter tuning.
Examples -------- >>> from sklearn.datasets import make_friedman2 >>> from sklearn.gaussian_process import GaussianProcessRegressor >>> from sklearn.gaussian_process.kernels import ExpSineSquared >>> X, y = make_friedman2(n_samples=50, noise=0, random_state=0) >>> kernel = ExpSineSquared(length_scale=1, periodicity=1) >>> gpr = GaussianProcessRegressor(kernel=kernel, alpha=5, ... random_state=0).fit(X, y) >>> gpr.score(X, y) 0.0144... >>> gpr.predict(X:2,:
, return_std=True) (array(425.6..., 457.5...
), array(0.3894..., 0.3467...
))