Rational Quadratic kernel.
The RationalQuadratic kernel can be seen as a scale mixture (an infinite sum) of RBF kernels with different characteristic length scales. It is parameterized by a length scale parameter :math:`l>0` and a scale mixture parameter :math:`\alpha>0`. Only the isotropic variant where length_scale :math:`l` is a scalar is supported at the moment. The kernel is given by:
.. math:: k(x_i, x_j) = \left( 1 + \fracd(x_i, x_j)^2
2\alpha l^2
\right)^
\alpha
}
where :math:`\alpha` is the scale mixture parameter, :math:`l` is the length scale of the kernel and :math:`d(\cdot,\cdot)` is the Euclidean distance. For advice on how to set the parameters, see e.g. 1
_.
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.
alpha : float > 0, default=1.0 Scale mixture parameter
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.
alpha_bounds : pair of floats >= 0 or 'fixed', default=(1e-5, 1e5) The lower and upper bound on 'alpha'. If set to 'fixed', 'alpha' cannot be changed during hyperparameter tuning.
References ---------- .. 1
`David Duvenaud (2014). 'The Kernel Cookbook: Advice on Covariance functions'. <https://www.cs.toronto.edu/~duvenaud/cookbook/>`_
Examples -------- >>> from sklearn.datasets import load_iris >>> from sklearn.gaussian_process import GaussianProcessClassifier >>> from sklearn.gaussian_process.kernels import Matern >>> X, y = load_iris(return_X_y=True) >>> kernel = RationalQuadratic(length_scale=1.0, alpha=1.5) >>> gpc = GaussianProcessClassifier(kernel=kernel, ... random_state=0).fit(X, y) >>> gpc.score(X, y) 0.9733... >>> gpc.predict_proba(X:2,:
) array([0.8881..., 0.0566..., 0.05518...],
[0.8678..., 0.0707... , 0.0614...]
)