Kernel which is composed of a set of other kernels.
New in version 0.18.
The other kernels
Returns the log-transformed bounds on the theta.
Returns a list of all hyperparameter specifications.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on discrete structures.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
__call__(X[, Y, eval_gradient])
Return the kernel k(X, Y) and optionally its gradient.
clone_with_theta(theta)
Returns a clone of self with given hyperparameters theta.
diag(X)
Returns the diagonal of the kernel k(X, X).
get_params([deep])
Get parameters of this kernel.
is_stationary()
Returns whether the kernel is stationary.
set_params(**params)
Set the parameters of this kernel.
Return the kernel k(X, Y) and optionally its gradient.
Note that this compound kernel returns the results of all simple kernel stacked along an additional axis.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) is evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.
Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta
Returns a clone of self with given hyperparameters theta.
The hyperparameters
Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Argument to the kernel.
Diagonal of kernel k(X, X)
Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Returns a list of all hyperparameter specifications.
Returns whether the kernel is stationary.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on discrete structures.
Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel


Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta


Returns a clone of self with given hyperparameters theta.
The hyperparameters


Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Argument to the kernel.
Diagonal of kernel k(X, X)


Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.


Returns a list of all hyperparameter specifications.


Returns whether the kernel is stationary.


Returns the number of non-fixed hyperparameters of the kernel.


Returns whether the kernel is defined on discrete structures.


Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.


Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel


Return the kernel k(X, Y) and optionally its gradient.
Note that this compound kernel returns the results of all simple kernel stacked along an additional axis.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) is evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.


Constant kernel.
Can be used as part of a product-kernel where it scales the magnitude of the other factor (kernel) or as part of a sum-kernel, where it modifies the mean of the Gaussian process.
Adding a constant kernel is equivalent to adding a constant:
is the same as:
Read more in the User Guide.
New in version 0.18.
The constant value which defines the covariance: k(x_1, x_2) = constant_value
The lower and upper bound on constant_value. If set to “fixed”, constant_value cannot be changed during hyperparameter tuning.
Returns the log-transformed bounds on the theta.
Returns a list of all hyperparameter specifications.
Returns the number of non-fixed hyperparameters of the kernel.
Whether the kernel works only on fixed-length feature vectors.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
__call__(X[, Y, eval_gradient])
Return the kernel k(X, Y) and optionally its gradient.
clone_with_theta(theta)
Returns a clone of self with given hyperparameters theta.
diag(X)
Returns the diagonal of the kernel k(X, X).
get_params([deep])
Get parameters of this kernel.
is_stationary()
Returns whether the kernel is stationary.
set_params(**params)
Set the parameters of this kernel.
Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) is evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is None.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.
Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta
Returns a clone of self with given hyperparameters theta.
The hyperparameters
Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Argument to the kernel.
Diagonal of kernel k(X, X)
Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Returns a list of all hyperparameter specifications.
Returns whether the kernel is stationary.
Returns the number of non-fixed hyperparameters of the kernel.
Whether the kernel works only on fixed-length feature vectors.
Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel


Constant kernel.
Can be used as part of a product-kernel where it scales the magnitude of the other factor (kernel) or as part of a sum-kernel, where it modifies the mean of the Gaussian process.
Adding a constant kernel is equivalent to adding a constant:
is the same as:
Read more in the User Guide.
New in version 0.18.
The constant value which defines the covariance: k(x_1, x_2) = constant_value
The lower and upper bound on constant_value. If set to “fixed”, constant_value cannot be changed during hyperparameter tuning.
Returns the log-transformed bounds on the theta.
Returns a list of all hyperparameter specifications.
Returns the number of non-fixed hyperparameters of the kernel.
Whether the kernel works only on fixed-length feature vectors.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
__call__(X[, Y, eval_gradient])
Return the kernel k(X, Y) and optionally its gradient.
clone_with_theta(theta)
Returns a clone of self with given hyperparameters theta.
diag(X)
Returns the diagonal of the kernel k(X, X).
get_params([deep])
Get parameters of this kernel.
is_stationary()
Returns whether the kernel is stationary.
set_params(**params)
Set the parameters of this kernel.
Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) is evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is None.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.
Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta
Returns a clone of self with given hyperparameters theta.
The hyperparameters
Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Argument to the kernel.
Diagonal of kernel k(X, X)
Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Returns a list of all hyperparameter specifications.
Returns whether the kernel is stationary.
Returns the number of non-fixed hyperparameters of the kernel.
Whether the kernel works only on fixed-length feature vectors.
Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel
Illustration of prior and posterior Gaussian process for different kernels
Iso-probability lines for Gaussian Processes classification (GPC)
Gaussian Processes regression: basic introductory example


Whether the kernel works only on fixed-length feature vectors.


Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) is evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is None.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.


Dot-Product kernel.
The DotProduct kernel is non-stationary and can be obtained from linear regression by putting \(N(0, 1)\) priors on the coefficients of \(x_d (d = 1, . . . , D)\) and a prior of \(N(0, \sigma_0^2)\) on the bias. The DotProduct kernel is invariant to a rotation of the coordinates about the origin, but not translations. It is parameterized by a parameter sigma_0 \(\sigma\) which controls the inhomogenity of the kernel. For \(\sigma_0^2 =0\), the kernel is called the homogeneous linear kernel, otherwise it is inhomogeneous. The kernel is given by
The DotProduct kernel is commonly combined with exponentiation.
See [1], Chapter 4, Section 4.2, for further details regarding the DotProduct kernel.
Read more in the User Guide.
New in version 0.18.
Parameter controlling the inhomogenity of the kernel. If sigma_0=0, the kernel is homogenous.
The lower and upper bound on ‘sigma_0’. If set to “fixed”, ‘sigma_0’ cannot be changed during hyperparameter tuning.
Returns the log-transformed bounds on the theta.
Returns a list of all hyperparameter specifications.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Carl Edward Rasmussen, Christopher K. I. Williams (2006). “Gaussian Processes for Machine Learning”. The MIT Press.
__call__(X[, Y, eval_gradient])
Return the kernel k(X, Y) and optionally its gradient.
clone_with_theta(theta)
Returns a clone of self with given hyperparameters theta.
diag(X)
Returns the diagonal of the kernel k(X, X).
get_params([deep])
Get parameters of this kernel.
is_stationary()
Returns whether the kernel is stationary.
set_params(**params)
Set the parameters of this kernel.
Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) if evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is None.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.
Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta
Returns a clone of self with given hyperparameters theta.
The hyperparameters
Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Left argument of the returned kernel k(X, Y).
Diagonal of kernel k(X, X).
Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Returns a list of all hyperparameter specifications.
Returns whether the kernel is stationary.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects. Defaults to True for backward compatibility.
Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel


Dot-Product kernel.
The DotProduct kernel is non-stationary and can be obtained from linear regression by putting \(N(0, 1)\) priors on the coefficients of \(x_d (d = 1, . . . , D)\) and a prior of \(N(0, \sigma_0^2)\) on the bias. The DotProduct kernel is invariant to a rotation of the coordinates about the origin, but not translations. It is parameterized by a parameter sigma_0 \(\sigma\) which controls the inhomogenity of the kernel. For \(\sigma_0^2 =0\), the kernel is called the homogeneous linear kernel, otherwise it is inhomogeneous. The kernel is given by
The DotProduct kernel is commonly combined with exponentiation.
See [1], Chapter 4, Section 4.2, for further details regarding the DotProduct kernel.
Read more in the User Guide.
New in version 0.18.
Parameter controlling the inhomogenity of the kernel. If sigma_0=0, the kernel is homogenous.
The lower and upper bound on ‘sigma_0’. If set to “fixed”, ‘sigma_0’ cannot be changed during hyperparameter tuning.
Returns the log-transformed bounds on the theta.
Returns a list of all hyperparameter specifications.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Carl Edward Rasmussen, Christopher K. I. Williams (2006). “Gaussian Processes for Machine Learning”. The MIT Press.
__call__(X[, Y, eval_gradient])
Return the kernel k(X, Y) and optionally its gradient.
clone_with_theta(theta)
Returns a clone of self with given hyperparameters theta.
diag(X)
Returns the diagonal of the kernel k(X, X).
get_params([deep])
Get parameters of this kernel.
is_stationary()
Returns whether the kernel is stationary.
set_params(**params)
Set the parameters of this kernel.
Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) if evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is None.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.
Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta
Returns a clone of self with given hyperparameters theta.
The hyperparameters
Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Left argument of the returned kernel k(X, Y).
Diagonal of kernel k(X, X).
Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Returns a list of all hyperparameter specifications.
Returns whether the kernel is stationary.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects. Defaults to True for backward compatibility.
Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel
Illustration of Gaussian process classification (GPC) on the XOR dataset
Illustration of prior and posterior Gaussian process for different kernels
Iso-probability lines for Gaussian Processes classification (GPC)


Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta


Returns a clone of self with given hyperparameters theta.
The hyperparameters


Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Left argument of the returned kernel k(X, Y).
Diagonal of kernel k(X, X).


Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.


Returns a list of all hyperparameter specifications.


Returns whether the kernel is stationary.


Returns the number of non-fixed hyperparameters of the kernel.


Returns whether the kernel is defined on fixed-length feature vectors or generic objects. Defaults to True for backward compatibility.


Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.


Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel


Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) if evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is None.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.


The Exponentiation kernel takes one base kernel and a scalar parameter \(p\) and combines them via
Note that the __pow__ magic method is overridden, so Exponentiation(RBF(), 2) is equivalent to using the ** operator with RBF() ** 2.
Read more in the User Guide.
New in version 0.18.
The base kernel
The exponent for the base kernel
Returns the log-transformed bounds on the theta.
Returns a list of all hyperparameter.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on discrete structures.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
__call__(X[, Y, eval_gradient])
Return the kernel k(X, Y) and optionally its gradient.
clone_with_theta(theta)
Returns a clone of self with given hyperparameters theta.
diag(X)
Returns the diagonal of the kernel k(X, X).
get_params([deep])
Get parameters of this kernel.
is_stationary()
Returns whether the kernel is stationary.
set_params(**params)
Set the parameters of this kernel.
Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) is evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.
Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta
Returns a clone of self with given hyperparameters theta.
The hyperparameters
Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Argument to the kernel.
Diagonal of kernel k(X, X)
Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Returns a list of all hyperparameter.
Returns whether the kernel is stationary.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on discrete structures.
Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel


Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Argument to the kernel.
Diagonal of kernel k(X, X)


Returns whether the kernel is defined on discrete structures.


Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) is evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.


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 \(l>0\) and a periodicity parameter \(p>0\). Only the isotropic variant where \(l\) is a scalar is supported at the moment. The kernel is given by:
where \(l\) is the length scale of the kernel, \(p\) the periodicity of the kernel and \(d(\\cdot,\\cdot)\) is the Euclidean distance.
Read more in the User Guide.
New in version 0.18.
The length scale of the kernel.
The periodicity of the kernel.
The lower and upper bound on ‘length_scale’. If set to “fixed”, ‘length_scale’ cannot be changed during hyperparameter tuning.
The lower and upper bound on ‘periodicity’. If set to “fixed”, ‘periodicity’ cannot be changed during hyperparameter tuning.
Returns the log-transformed bounds on the theta.
Returns the length scale
Returns a list of all hyperparameter specifications.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
__call__(X[, Y, eval_gradient])
Return the kernel k(X, Y) and optionally its gradient.
clone_with_theta(theta)
Returns a clone of self with given hyperparameters theta.
diag(X)
Returns the diagonal of the kernel k(X, X).
get_params([deep])
Get parameters of this kernel.
is_stationary()
Returns whether the kernel is stationary.
set_params(**params)
Set the parameters of this kernel.
Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) if evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is None.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.
Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta
Returns a clone of self with given hyperparameters theta.
The hyperparameters
Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Left argument of the returned kernel k(X, Y)
Diagonal of kernel k(X, X)
Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Returns the length scale
Returns a list of all hyperparameter specifications.
Returns whether the kernel is stationary.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects. Defaults to True for backward compatibility.
Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel


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 \(l>0\) and a periodicity parameter \(p>0\). Only the isotropic variant where \(l\) is a scalar is supported at the moment. The kernel is given by:
where \(l\) is the length scale of the kernel, \(p\) the periodicity of the kernel and \(d(\\cdot,\\cdot)\) is the Euclidean distance.
Read more in the User Guide.
New in version 0.18.
The length scale of the kernel.
The periodicity of the kernel.
The lower and upper bound on ‘length_scale’. If set to “fixed”, ‘length_scale’ cannot be changed during hyperparameter tuning.
The lower and upper bound on ‘periodicity’. If set to “fixed”, ‘periodicity’ cannot be changed during hyperparameter tuning.
Returns the log-transformed bounds on the theta.
Returns the length scale
Returns a list of all hyperparameter specifications.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
__call__(X[, Y, eval_gradient])
Return the kernel k(X, Y) and optionally its gradient.
clone_with_theta(theta)
Returns a clone of self with given hyperparameters theta.
diag(X)
Returns the diagonal of the kernel k(X, X).
get_params([deep])
Get parameters of this kernel.
is_stationary()
Returns whether the kernel is stationary.
set_params(**params)
Set the parameters of this kernel.
Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) if evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is None.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.
Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta
Returns a clone of self with given hyperparameters theta.
The hyperparameters
Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Left argument of the returned kernel k(X, Y)
Diagonal of kernel k(X, X)
Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Returns the length scale
Returns a list of all hyperparameter specifications.
Returns whether the kernel is stationary.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects. Defaults to True for backward compatibility.
Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel
Comparison of kernel ridge and Gaussian process regression
Illustration of prior and posterior Gaussian process for different kernels
Gaussian process regression (GPR) on Mauna Loa CO2 data.


Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta


Returns a clone of self with given hyperparameters theta.
The hyperparameters


Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Left argument of the returned kernel k(X, Y)
Diagonal of kernel k(X, X)


Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.


Returns a list of all hyperparameter specifications.


Returns whether the kernel is stationary.


Returns the number of non-fixed hyperparameters of the kernel.


Returns whether the kernel is defined on fixed-length feature vectors or generic objects. Defaults to True for backward compatibility.


Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.


Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel


Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) if evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is None.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.


A kernel hyperparameter’s specification in form of a namedtuple.
New in version 0.18.
The name of the hyperparameter. Note that a kernel using a hyperparameter with name “x” must have the attributes self.x and self.x_bounds
The type of the hyperparameter. Currently, only “numeric” hyperparameters are supported.
The lower and upper bound on the parameter. If n_elements>1, a pair of 1d array with n_elements each may be given alternatively. If the string “fixed” is passed as bounds, the hyperparameter’s value cannot be changed.
The number of elements of the hyperparameter value. Defaults to 1, which corresponds to a scalar hyperparameter. n_elements > 1 corresponds to a hyperparameter which is vector-valued, such as, e.g., anisotropic length-scales.
Whether the value of this hyperparameter is fixed, i.e., cannot be changed during hyperparameter tuning. If None is passed, the “fixed” is derived based on the given bounds.
We can access each hyperparameter:
count(value, /)
Return number of occurrences of value.
index(value[, start, stop])
Return first index of value.
Call self as a function.
Alias for field number 2
Return number of occurrences of value.
Alias for field number 4
Return first index of value.
Raises ValueError if the value is not present.
Alias for field number 3
Alias for field number 0
Alias for field number 1


A kernel hyperparameter’s specification in form of a namedtuple.
New in version 0.18.
The name of the hyperparameter. Note that a kernel using a hyperparameter with name “x” must have the attributes self.x and self.x_bounds
The type of the hyperparameter. Currently, only “numeric” hyperparameters are supported.
The lower and upper bound on the parameter. If n_elements>1, a pair of 1d array with n_elements each may be given alternatively. If the string “fixed” is passed as bounds, the hyperparameter’s value cannot be changed.
The number of elements of the hyperparameter value. Defaults to 1, which corresponds to a scalar hyperparameter. n_elements > 1 corresponds to a hyperparameter which is vector-valued, such as, e.g., anisotropic length-scales.
Whether the value of this hyperparameter is fixed, i.e., cannot be changed during hyperparameter tuning. If None is passed, the “fixed” is derived based on the given bounds.
We can access each hyperparameter:
count(value, /)
Return number of occurrences of value.
index(value[, start, stop])
Return first index of value.
Call self as a function.
Alias for field number 2
Return number of occurrences of value.
Alias for field number 4
Return first index of value.
Raises ValueError if the value is not present.
Alias for field number 3
Alias for field number 0
Alias for field number 1
Gaussian processes on discrete data structures


Return first index of value.
Raises ValueError if the value is not present.


Base class for all kernels.
New in version 0.18.
Returns the log-transformed bounds on the theta.
Returns a list of all hyperparameter specifications.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
__call__(X[, Y, eval_gradient])
Evaluate the kernel.
clone_with_theta(theta)
Returns a clone of self with given hyperparameters theta.
diag(X)
Returns the diagonal of the kernel k(X, X).
get_params([deep])
Get parameters of this kernel.
is_stationary()
Returns whether the kernel is stationary.
set_params(**params)
Set the parameters of this kernel.
Evaluate the kernel.
Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta
Returns a clone of self with given hyperparameters theta.
The hyperparameters
Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Left argument of the returned kernel k(X, Y)
Diagonal of kernel k(X, X)
Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Returns a list of all hyperparameter specifications.
Returns whether the kernel is stationary.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects. Defaults to True for backward compatibility.
Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel
Gaussian processes on discrete data structures


Base class for all kernels.
New in version 0.18.
Returns the log-transformed bounds on the theta.
Returns a list of all hyperparameter specifications.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
__call__(X[, Y, eval_gradient])
Evaluate the kernel.
clone_with_theta(theta)
Returns a clone of self with given hyperparameters theta.
diag(X)
Returns the diagonal of the kernel k(X, X).
get_params([deep])
Get parameters of this kernel.
is_stationary()
Returns whether the kernel is stationary.
set_params(**params)
Set the parameters of this kernel.
Evaluate the kernel.
Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta
Returns a clone of self with given hyperparameters theta.
The hyperparameters
Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Left argument of the returned kernel k(X, Y)
Diagonal of kernel k(X, X)
Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Returns a list of all hyperparameter specifications.
Returns whether the kernel is stationary.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects. Defaults to True for backward compatibility.
Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel


Matern kernel.
The class of Matern kernels is a generalization of the RBF. It has an additional parameter \(\nu\) which controls the smoothness of the resulting function. The smaller \(\nu\), the less smooth the approximated function is. As \(\nu\rightarrow\infty\), the kernel becomes equivalent to the RBF kernel. When \(\nu = 1/2\), the Matérn kernel becomes identical to the absolute exponential kernel. Important intermediate values are \(\nu=1.5\) (once differentiable functions) and \(\nu=2.5\) (twice differentiable functions).
The kernel is given by:
where \(d(\cdot,\cdot)\) is the Euclidean distance, \(K_{\nu}(\cdot)\) is a modified Bessel function and \(\Gamma(\cdot)\) is the gamma function. See [1], Chapter 4, Section 4.2, for details regarding the different variants of the Matern kernel.
Read more in the User Guide.
New in version 0.18.
The length scale of the kernel. If a float, an isotropic kernel is used. If an array, an anisotropic kernel is used where each dimension of l defines the length-scale of the respective feature dimension.
The lower and upper bound on ‘length_scale’. If set to “fixed”, ‘length_scale’ cannot be changed during hyperparameter tuning.
The parameter nu controlling the smoothness of the learned function. The smaller nu, the less smooth the approximated function is. For nu=inf, the kernel becomes equivalent to the RBF kernel and for nu=0.5 to the absolute exponential kernel. Important intermediate values are nu=1.5 (once differentiable functions) and nu=2.5 (twice differentiable functions). Note that values of nu not in [0.5, 1.5, 2.5, inf] incur a considerably higher computational cost (appr. 10 times higher) since they require to evaluate the modified Bessel function. Furthermore, in contrast to l, nu is kept fixed to its initial value and not optimized.
Returns the log-transformed bounds on the theta.
Returns a list of all hyperparameter specifications.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Carl Edward Rasmussen, Christopher K. I. Williams (2006). “Gaussian Processes for Machine Learning”. The MIT Press.
__call__(X[, Y, eval_gradient])
Return the kernel k(X, Y) and optionally its gradient.
clone_with_theta(theta)
Returns a clone of self with given hyperparameters theta.
diag(X)
Returns the diagonal of the kernel k(X, X).
get_params([deep])
Get parameters of this kernel.
is_stationary()
Returns whether the kernel is stationary.
set_params(**params)
Set the parameters of this kernel.
Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) if evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is None.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.
Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta
Returns a clone of self with given hyperparameters theta.
The hyperparameters
Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Left argument of the returned kernel k(X, Y)
Diagonal of kernel k(X, X)
Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Returns a list of all hyperparameter specifications.
Returns whether the kernel is stationary.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects. Defaults to True for backward compatibility.
Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel


Matern kernel.
The class of Matern kernels is a generalization of the RBF. It has an additional parameter \(\nu\) which controls the smoothness of the resulting function. The smaller \(\nu\), the less smooth the approximated function is. As \(\nu\rightarrow\infty\), the kernel becomes equivalent to the RBF kernel. When \(\nu = 1/2\), the Matérn kernel becomes identical to the absolute exponential kernel. Important intermediate values are \(\nu=1.5\) (once differentiable functions) and \(\nu=2.5\) (twice differentiable functions).
The kernel is given by:
where \(d(\cdot,\cdot)\) is the Euclidean distance, \(K_{\nu}(\cdot)\) is a modified Bessel function and \(\Gamma(\cdot)\) is the gamma function. See [1], Chapter 4, Section 4.2, for details regarding the different variants of the Matern kernel.
Read more in the User Guide.
New in version 0.18.
The length scale of the kernel. If a float, an isotropic kernel is used. If an array, an anisotropic kernel is used where each dimension of l defines the length-scale of the respective feature dimension.
The lower and upper bound on ‘length_scale’. If set to “fixed”, ‘length_scale’ cannot be changed during hyperparameter tuning.
The parameter nu controlling the smoothness of the learned function. The smaller nu, the less smooth the approximated function is. For nu=inf, the kernel becomes equivalent to the RBF kernel and for nu=0.5 to the absolute exponential kernel. Important intermediate values are nu=1.5 (once differentiable functions) and nu=2.5 (twice differentiable functions). Note that values of nu not in [0.5, 1.5, 2.5, inf] incur a considerably higher computational cost (appr. 10 times higher) since they require to evaluate the modified Bessel function. Furthermore, in contrast to l, nu is kept fixed to its initial value and not optimized.
Returns the log-transformed bounds on the theta.
Returns a list of all hyperparameter specifications.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Carl Edward Rasmussen, Christopher K. I. Williams (2006). “Gaussian Processes for Machine Learning”. The MIT Press.
__call__(X[, Y, eval_gradient])
Return the kernel k(X, Y) and optionally its gradient.
clone_with_theta(theta)
Returns a clone of self with given hyperparameters theta.
diag(X)
Returns the diagonal of the kernel k(X, X).
get_params([deep])
Get parameters of this kernel.
is_stationary()
Returns whether the kernel is stationary.
set_params(**params)
Set the parameters of this kernel.
Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) if evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is None.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.
Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta
Returns a clone of self with given hyperparameters theta.
The hyperparameters
Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Left argument of the returned kernel k(X, Y)
Diagonal of kernel k(X, X)
Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Returns a list of all hyperparameter specifications.
Returns whether the kernel is stationary.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects. Defaults to True for backward compatibility.
Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel
Illustration of prior and posterior Gaussian process for different kernels


Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta


Returns a clone of self with given hyperparameters theta.
The hyperparameters


Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Left argument of the returned kernel k(X, Y)
Diagonal of kernel k(X, X)


Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.


Returns a list of all hyperparameter specifications.


Returns whether the kernel is stationary.


Returns the number of non-fixed hyperparameters of the kernel.


Returns whether the kernel is defined on fixed-length feature vectors or generic objects. Defaults to True for backward compatibility.


Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.


Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel


Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) if evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is None.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.


Wrapper for kernels in sklearn.metrics.pairwise.
A thin wrapper around the functionality of the kernels in sklearn.metrics.pairwise.
kernels support only isotropic distances. The parameter gamma is considered to be a hyperparameter and may be optimized. The other kernel parameters are set directly at initialization and are kept fixed.
New in version 0.18.
Parameter gamma of the pairwise kernel specified by metric. It should be positive.
The lower and upper bound on ‘gamma’. If set to “fixed”, ‘gamma’ cannot be changed during hyperparameter tuning.
The metric to use when calculating kernel between instances in a feature array. If metric is a string, it must be one of the metrics in pairwise.PAIRWISE_KERNEL_FUNCTIONS. If metric is “precomputed”, X is assumed to be a kernel matrix. Alternatively, if metric is a callable function, it is called on each pair of instances (rows) and the resulting value recorded. The callable should take two arrays from X as input and return a value indicating the distance between them.
All entries of this dict (if any) are passed as keyword arguments to the pairwise kernel function.
Returns the log-transformed bounds on the theta.
Returns a list of all hyperparameter specifications.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
__call__(X[, Y, eval_gradient])
Return the kernel k(X, Y) and optionally its gradient.
clone_with_theta(theta)
Returns a clone of self with given hyperparameters theta.
diag(X)
Returns the diagonal of the kernel k(X, X).
get_params([deep])
Get parameters of this kernel.
is_stationary()
Returns whether the kernel is stationary.
set_params(**params)
Set the parameters of this kernel.
Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) if evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is None.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.
Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta
Returns a clone of self with given hyperparameters theta.
The hyperparameters
Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Left argument of the returned kernel k(X, Y)
Diagonal of kernel k(X, X)
Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Returns a list of all hyperparameter specifications.
Returns whether the kernel is stationary.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects. Defaults to True for backward compatibility.
Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel


The Product kernel takes two kernels \(k_1\) and \(k_2\) and combines them via
Note that the __mul__ magic method is overridden, so Product(RBF(), RBF()) is equivalent to using the * operator with RBF() * RBF().
Read more in the User Guide.
New in version 0.18.
The first base-kernel of the product-kernel
The second base-kernel of the product-kernel
Returns the log-transformed bounds on the theta.
Returns a list of all hyperparameter.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is stationary.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
__call__(X[, Y, eval_gradient])
Return the kernel k(X, Y) and optionally its gradient.
clone_with_theta(theta)
Returns a clone of self with given hyperparameters theta.
diag(X)
Returns the diagonal of the kernel k(X, X).
get_params([deep])
Get parameters of this kernel.
is_stationary()
Returns whether the kernel is stationary.
set_params(**params)
Set the parameters of this kernel.
Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) is evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.
Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta
Returns a clone of self with given hyperparameters theta.
The hyperparameters
Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Argument to the kernel.
Diagonal of kernel k(X, X)
Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Returns a list of all hyperparameter.
Returns whether the kernel is stationary.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is stationary.
Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel


Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Argument to the kernel.
Diagonal of kernel k(X, X)


Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) is evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.


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 \(l>0\) and a scale mixture parameter \(\alpha>0\). Only the isotropic variant where length_scale \(l\) is a scalar is supported at the moment. The kernel is given by:
where \(\alpha\) is the scale mixture parameter, \(l\) is the length scale of the kernel and \(d(\cdot,\cdot)\) is the Euclidean distance. For advice on how to set the parameters, see e.g. [1].
Read more in the User Guide.
New in version 0.18.
The length scale of the kernel.
Scale mixture parameter
The lower and upper bound on ‘length_scale’. If set to “fixed”, ‘length_scale’ cannot be changed during hyperparameter tuning.
The lower and upper bound on ‘alpha’. If set to “fixed”, ‘alpha’ cannot be changed during hyperparameter tuning.
Returns the log-transformed bounds on the theta.
Returns a list of all hyperparameter specifications.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
David Duvenaud (2014). “The Kernel Cookbook: Advice on Covariance functions”.
__call__(X[, Y, eval_gradient])
Return the kernel k(X, Y) and optionally its gradient.
clone_with_theta(theta)
Returns a clone of self with given hyperparameters theta.
diag(X)
Returns the diagonal of the kernel k(X, X).
get_params([deep])
Get parameters of this kernel.
is_stationary()
Returns whether the kernel is stationary.
set_params(**params)
Set the parameters of this kernel.
Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) if evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is None.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.
Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta
Returns a clone of self with given hyperparameters theta.
The hyperparameters
Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Left argument of the returned kernel k(X, Y)
Diagonal of kernel k(X, X)
Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Returns a list of all hyperparameter specifications.
Returns whether the kernel is stationary.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects. Defaults to True for backward compatibility.
Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel


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 \(l>0\) and a scale mixture parameter \(\alpha>0\). Only the isotropic variant where length_scale \(l\) is a scalar is supported at the moment. The kernel is given by:
where \(\alpha\) is the scale mixture parameter, \(l\) is the length scale of the kernel and \(d(\cdot,\cdot)\) is the Euclidean distance. For advice on how to set the parameters, see e.g. [1].
Read more in the User Guide.
New in version 0.18.
The length scale of the kernel.
Scale mixture parameter
The lower and upper bound on ‘length_scale’. If set to “fixed”, ‘length_scale’ cannot be changed during hyperparameter tuning.
The lower and upper bound on ‘alpha’. If set to “fixed”, ‘alpha’ cannot be changed during hyperparameter tuning.
Returns the log-transformed bounds on the theta.
Returns a list of all hyperparameter specifications.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
David Duvenaud (2014). “The Kernel Cookbook: Advice on Covariance functions”.
__call__(X[, Y, eval_gradient])
Return the kernel k(X, Y) and optionally its gradient.
clone_with_theta(theta)
Returns a clone of self with given hyperparameters theta.
diag(X)
Returns the diagonal of the kernel k(X, X).
get_params([deep])
Get parameters of this kernel.
is_stationary()
Returns whether the kernel is stationary.
set_params(**params)
Set the parameters of this kernel.
Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) if evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is None.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.
Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta
Returns a clone of self with given hyperparameters theta.
The hyperparameters
Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Left argument of the returned kernel k(X, Y)
Diagonal of kernel k(X, X)
Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Returns a list of all hyperparameter specifications.
Returns whether the kernel is stationary.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects. Defaults to True for backward compatibility.
Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel
Illustration of prior and posterior Gaussian process for different kernels
Gaussian process regression (GPR) on Mauna Loa CO2 data.


Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta


Returns a clone of self with given hyperparameters theta.
The hyperparameters


Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Left argument of the returned kernel k(X, Y)
Diagonal of kernel k(X, X)


Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.


Returns a list of all hyperparameter specifications.


Returns whether the kernel is stationary.


Returns the number of non-fixed hyperparameters of the kernel.


Returns whether the kernel is defined on fixed-length feature vectors or generic objects. Defaults to True for backward compatibility.


Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.


Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel


Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) if evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is None.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.


Radial-basis function kernel (aka squared-exponential kernel).
The RBF kernel is a stationary kernel. It is also known as the “squared exponential” kernel. It is parameterized by a length scale parameter \(l>0\), which can either be a scalar (isotropic variant of the kernel) or a vector with the same number of dimensions as the inputs X (anisotropic variant of the kernel). The kernel is given by:
where \(l\) is the length scale of the kernel and \(d(\cdot,\cdot)\) is the Euclidean distance. For advice on how to set the length scale parameter, see e.g. [1].
This kernel is infinitely differentiable, which implies that GPs with this kernel as covariance function have mean square derivatives of all orders, and are thus very smooth. See [2], Chapter 4, Section 4.2, for further details of the RBF kernel.
Read more in the User Guide.
New in version 0.18.
The length scale of the kernel. If a float, an isotropic kernel is used. If an array, an anisotropic kernel is used where each dimension of l defines the length-scale of the respective feature dimension.
The lower and upper bound on ‘length_scale’. If set to “fixed”, ‘length_scale’ cannot be changed during hyperparameter tuning.
Returns the log-transformed bounds on the theta.
Returns a list of all hyperparameter specifications.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
David Duvenaud (2014). “The Kernel Cookbook: Advice on Covariance functions”.
Carl Edward Rasmussen, Christopher K. I. Williams (2006). “Gaussian Processes for Machine Learning”. The MIT Press.
__call__(X[, Y, eval_gradient])
Return the kernel k(X, Y) and optionally its gradient.
clone_with_theta(theta)
Returns a clone of self with given hyperparameters theta.
diag(X)
Returns the diagonal of the kernel k(X, X).
get_params([deep])
Get parameters of this kernel.
is_stationary()
Returns whether the kernel is stationary.
set_params(**params)
Set the parameters of this kernel.
Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) if evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is None.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.
Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta
Returns a clone of self with given hyperparameters theta.
The hyperparameters
Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Left argument of the returned kernel k(X, Y)
Diagonal of kernel k(X, X)
Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Returns a list of all hyperparameter specifications.
Returns whether the kernel is stationary.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects. Defaults to True for backward compatibility.
Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel


Radial-basis function kernel (aka squared-exponential kernel).
The RBF kernel is a stationary kernel. It is also known as the “squared exponential” kernel. It is parameterized by a length scale parameter \(l>0\), which can either be a scalar (isotropic variant of the kernel) or a vector with the same number of dimensions as the inputs X (anisotropic variant of the kernel). The kernel is given by:
where \(l\) is the length scale of the kernel and \(d(\cdot,\cdot)\) is the Euclidean distance. For advice on how to set the length scale parameter, see e.g. [1].
This kernel is infinitely differentiable, which implies that GPs with this kernel as covariance function have mean square derivatives of all orders, and are thus very smooth. See [2], Chapter 4, Section 4.2, for further details of the RBF kernel.
Read more in the User Guide.
New in version 0.18.
The length scale of the kernel. If a float, an isotropic kernel is used. If an array, an anisotropic kernel is used where each dimension of l defines the length-scale of the respective feature dimension.
The lower and upper bound on ‘length_scale’. If set to “fixed”, ‘length_scale’ cannot be changed during hyperparameter tuning.
Returns the log-transformed bounds on the theta.
Returns a list of all hyperparameter specifications.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
David Duvenaud (2014). “The Kernel Cookbook: Advice on Covariance functions”.
Carl Edward Rasmussen, Christopher K. I. Williams (2006). “Gaussian Processes for Machine Learning”. The MIT Press.
__call__(X[, Y, eval_gradient])
Return the kernel k(X, Y) and optionally its gradient.
clone_with_theta(theta)
Returns a clone of self with given hyperparameters theta.
diag(X)
Returns the diagonal of the kernel k(X, X).
get_params([deep])
Get parameters of this kernel.
is_stationary()
Returns whether the kernel is stationary.
set_params(**params)
Set the parameters of this kernel.
Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) if evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is None.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.
Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta
Returns a clone of self with given hyperparameters theta.
The hyperparameters
Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Left argument of the returned kernel k(X, Y)
Diagonal of kernel k(X, X)
Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Returns a list of all hyperparameter specifications.
Returns whether the kernel is stationary.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is defined on fixed-length feature vectors or generic objects. Defaults to True for backward compatibility.
Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel
Plot classification probability
Classifier comparison
Illustration of Gaussian process classification (GPC) on the XOR dataset
Gaussian process classification (GPC) on iris dataset
Illustration of prior and posterior Gaussian process for different kernels
Probabilistic predictions with Gaussian process classification (GPC)
Gaussian process regression (GPR) with noise-level estimation
Gaussian Processes regression: basic introductory example
Gaussian process regression (GPR) on Mauna Loa CO2 data.


The Sum kernel takes two kernels \(k_1\) and \(k_2\) and combines them via
Note that the __add__ magic method is overridden, so Sum(RBF(), RBF()) is equivalent to using the + operator with RBF() + RBF().
Read more in the User Guide.
New in version 0.18.
The first base-kernel of the sum-kernel
The second base-kernel of the sum-kernel
Returns the log-transformed bounds on the theta.
Returns a list of all hyperparameter.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is stationary.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
__call__(X[, Y, eval_gradient])
Return the kernel k(X, Y) and optionally its gradient.
clone_with_theta(theta)
Returns a clone of self with given hyperparameters theta.
diag(X)
Returns the diagonal of the kernel k(X, X).
get_params([deep])
Get parameters of this kernel.
is_stationary()
Returns whether the kernel is stationary.
set_params(**params)
Set the parameters of this kernel.
Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) is evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.
Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta
Returns a clone of self with given hyperparameters theta.
The hyperparameters
Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Argument to the kernel.
Diagonal of kernel k(X, X)
Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Returns a list of all hyperparameter.
Returns whether the kernel is stationary.
Returns the number of non-fixed hyperparameters of the kernel.
Returns whether the kernel is stationary.
Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel


Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Argument to the kernel.
Diagonal of kernel k(X, X)


Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) is evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.


White kernel.
The main use-case of this kernel is as part of a sum-kernel where it explains the noise of the signal as independently and identically normally-distributed. The parameter noise_level equals the variance of this noise.
Read more in the User Guide.
New in version 0.18.
Parameter controlling the noise level (variance)
The lower and upper bound on ‘noise_level’. If set to “fixed”, ‘noise_level’ cannot be changed during hyperparameter tuning.
Returns the log-transformed bounds on the theta.
Returns a list of all hyperparameter specifications.
Returns the number of non-fixed hyperparameters of the kernel.
Whether the kernel works only on fixed-length feature vectors.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
__call__(X[, Y, eval_gradient])
Return the kernel k(X, Y) and optionally its gradient.
clone_with_theta(theta)
Returns a clone of self with given hyperparameters theta.
diag(X)
Returns the diagonal of the kernel k(X, X).
get_params([deep])
Get parameters of this kernel.
is_stationary()
Returns whether the kernel is stationary.
set_params(**params)
Set the parameters of this kernel.
Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) is evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is None.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.
Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta
Returns a clone of self with given hyperparameters theta.
The hyperparameters
Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Argument to the kernel.
Diagonal of kernel k(X, X)
Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Returns a list of all hyperparameter specifications.
Returns whether the kernel is stationary.
Returns the number of non-fixed hyperparameters of the kernel.
Whether the kernel works only on fixed-length feature vectors.
Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel


White kernel.
The main use-case of this kernel is as part of a sum-kernel where it explains the noise of the signal as independently and identically normally-distributed. The parameter noise_level equals the variance of this noise.
Read more in the User Guide.
New in version 0.18.
Parameter controlling the noise level (variance)
The lower and upper bound on ‘noise_level’. If set to “fixed”, ‘noise_level’ cannot be changed during hyperparameter tuning.
Returns the log-transformed bounds on the theta.
Returns a list of all hyperparameter specifications.
Returns the number of non-fixed hyperparameters of the kernel.
Whether the kernel works only on fixed-length feature vectors.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
__call__(X[, Y, eval_gradient])
Return the kernel k(X, Y) and optionally its gradient.
clone_with_theta(theta)
Returns a clone of self with given hyperparameters theta.
diag(X)
Returns the diagonal of the kernel k(X, X).
get_params([deep])
Get parameters of this kernel.
is_stationary()
Returns whether the kernel is stationary.
set_params(**params)
Set the parameters of this kernel.
Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) is evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is None.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.
Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta
Returns a clone of self with given hyperparameters theta.
The hyperparameters
Returns the diagonal of the kernel k(X, X).
The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.
Argument to the kernel.
Diagonal of kernel k(X, X)
Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Returns a list of all hyperparameter specifications.
Returns whether the kernel is stationary.
Returns the number of non-fixed hyperparameters of the kernel.
Whether the kernel works only on fixed-length feature vectors.
Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel
Comparison of kernel ridge and Gaussian process regression
Gaussian process regression (GPR) with noise-level estimation
Gaussian process regression (GPR) on Mauna Loa CO2 data.


Returns the log-transformed bounds on the theta.
The log-transformed bounds on the kernel’s hyperparameters theta


Returns a clone of self with given hyperparameters theta.
The hyperparameters


Get parameters of this kernel.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.


Returns a list of all hyperparameter specifications.


Returns whether the kernel is stationary.


Returns the number of non-fixed hyperparameters of the kernel.


Whether the kernel works only on fixed-length feature vectors.


Set the parameters of this kernel.
The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.


Returns the (flattened, log-transformed) non-fixed hyperparameters.
Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.
The non-fixed, log-transformed hyperparameters of the kernel


Return the kernel k(X, Y) and optionally its gradient.
Left argument of the returned kernel k(X, Y)
Right argument of the returned kernel k(X, Y). If None, k(X, X) is evaluated instead.
Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is None.
Kernel k(X, Y)
The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.


Retrieve current values for configuration set by set_config
Keys are parameter names that can be passed to set_config.
See also
Context manager for global scikit-learn configuration.
Set global scikit-learn configuration.


Multivariate imputer that estimates each feature from all the others.
A strategy for imputing missing values by modeling each feature with missing values as a function of other features in a round-robin fashion.
Read more in the User Guide.
New in version 0.21.
Note
This estimator is still experimental for now: the predictions and the API might change without any deprecation cycle. To use it, you need to explicitly import enable_iterative_imputer:
The estimator to use at each step of the round-robin imputation. If sample_posterior is True, the estimator must support return_std in its predict method.
The placeholder for the missing values. All occurrences of missing_values will be imputed. For pandas’ dataframes with nullable integer dtypes with missing values, missing_values should be set to np.nan, since pd.NA will be converted to np.nan.
Whether to sample from the (Gaussian) predictive posterior of the fitted estimator for each imputation. Estimator must support return_std in its predict method if set to True. Set to True if using IterativeImputer for multiple imputations.
Maximum number of imputation rounds to perform before returning the imputations computed during the final round. A round is a single imputation of each feature with missing values. The stopping criterion is met once max(abs(X_t - X_{t-1}))/max(abs(X[known_vals])) < tol, where X_t is X at iteration t. Note that early stopping is only
applied if ``sample_posterior=False`.
Tolerance of the stopping condition.
Number of other features to use to estimate the missing values of each feature column. Nearness between features is measured using the absolute correlation coefficient between each feature pair (after initial imputation). To ensure coverage of features throughout the imputation process, the neighbor features are not necessarily nearest, but are drawn with probability proportional to correlation for each imputed target feature. Can provide significant speed-up when the number of features is huge. If None, all features will be used.
Which strategy to use to initialize the missing values. Same as the strategy parameter in SimpleImputer Valid values: {“mean”, “median”, “most_frequent”, or “constant”}.
The order in which the features will be imputed. Possible values:
From features with fewest missing values to most.
From features with most missing values to fewest.
Left to right.
Right to left.
A random order for each round.
If True then features with missing values during transform which did not have any missing values during fit will be imputed with the initial imputation method only. Set to True if you have many features with no missing values at both fit and transform time to save compute.
Minimum possible imputed value. Broadcast to shape (n_features,) if scalar. If array-like, expects shape (n_features,), one min value for each feature. The default is -np.inf.
Changed in version 0.23: Added support for array-like.
Maximum possible imputed value. Broadcast to shape (n_features,) if scalar. If array-like, expects shape (n_features,), one max value for each feature. The default is np.inf.
Changed in version 0.23: Added support for array-like.
Verbosity flag, controls the debug messages that are issued as functions are evaluated. The higher, the more verbose. Can be 0, 1, or 2.
The seed of the pseudo random number generator to use. Randomizes selection of estimator features if n_nearest_features is not None, the imputation_order if random, and the sampling from posterior if sample_posterior is True. Use an integer for determinism. See the Glossary.
If True, a MissingIndicator transform will stack onto output of the imputer’s transform. This allows a predictive estimator to account for missingness despite imputation. If a feature has no missing values at fit/train time, the feature won’t appear on the missing indicator even if there are missing values at transform/test time.
Imputer used to initialize the missing values.
Each tuple has (feat_idx, neighbor_feat_idx, estimator), where feat_idx is the current feature to be imputed, neighbor_feat_idx is the array of other features used to impute the current feature, and estimator is the trained estimator used for the imputation. Length is self.n_features_with_missing_ *
self.n_iter_.
Number of iteration rounds that occurred. Will be less than self.max_iter if early stopping criterion was reached.
Number of features with missing values.
Indicator used to add binary indicators for missing values. None if add_indicator is False.
RandomState instance that is generated either from a seed, the random number generator or by np.random.
See also
Univariate imputation of missing values.
To support imputation in inductive mode we store each feature’s estimator during the fit phase, and predict without refitting (in order) during the transform phase.
Features which contain all missing values at fit are discarded upon transform.
Stef van Buuren, Karin Groothuis-Oudshoorn (2011). “mice: Multivariate Imputation by Chained Equations in R”. Journal of Statistical Software 45: 1-67.
S. F. Buck, (1960). “A Method of Estimation of Missing Values in Multivariate Data Suitable for use with an Electronic Computer”. Journal of the Royal Statistical Society 22(2): 302-306.
fit(X[, y])
Fits the imputer on X and return self.
fit_transform(X[, y])
Fits the imputer on X and return the transformed X.
get_params([deep])
Get parameters for this estimator.
set_params(**params)
Set the parameters of this estimator.
transform(X)
Imputes all missing values in X.
Fits the imputer on X and return self.
Input data, where “n_samples” is the number of samples and “n_features” is the number of features.
Returns self.
Fits the imputer on X and return the transformed X.
Input data, where “n_samples” is the number of samples and “n_features” is the number of features.
The imputed input data.
Get parameters for this estimator.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.
Estimator parameters.
Estimator instance.
Imputes all missing values in X.
Note that this is stochastic, and that if random_state is not fixed, repeated calls, or permuted input, will yield different results.
The input data to complete.
The imputed input data.