@@ -752,7 +752,7 @@ def matern_kernel(X, Y=None, gamma=None, coef0=1.5):
752
752
The class of Matern kernels is a generalization of the RBF and
753
753
absolute exponential kernel parameterized by an additional parameter
754
754
coef0 (commonly denoted as nu in the literature). The smaller coef0,
755
- the less smooth the approximated function is. For nu-> inf, the kernel
755
+ the less smooth the approximated function is. For nu= inf, the kernel
756
756
becomes equivalent to the RBF kernel and for nu=0.5 to the absolute
757
757
exponential kernel. Important intermediate values are nu=1.5 (once
758
758
differentiable functions) and nu=2.5 (twice differentiable functions).
@@ -769,13 +769,25 @@ def matern_kernel(X, Y=None, gamma=None, coef0=1.5):
769
769
gamma : float
770
770
771
771
coef0 : float>0.0 (the parameter nu)
772
+ The parameter nu controlling the smoothness of the learned function.
773
+ The smaller coef0, the less smooth the approximated function is.
774
+ For nu=inf, the kernel becomes equivalent to the RBF kernel and for
775
+ nu=0.5 to the absolute exponential kernel. Important intermediate
776
+ values are nu=1.5 (once differentiable functions) and nu=2.5
777
+ (twice differentiable functions). Note that values of nu not in
778
+ [0.5, 1.5, 2.5, inf] incur a considerably higher computational cost
779
+ (appr. 10 times higher) since they require to evaluate the modified
780
+ Bessel function.
781
+
772
782
773
783
Returns
774
784
-------
775
785
kernel_matrix : array of shape (n_samples_X, n_samples_Y)
776
786
"""
777
787
if coef0 == np .inf : # fall back to rbf-kernel
778
788
return rbf_kernel (X , Y , gamma )
789
+ elif coef0 <= 0.0 :
790
+ raise ValueError ("coef0 of Matérn kernel must be strictly positive." )
779
791
780
792
X , Y = check_pairwise_arrays (X , Y )
781
793
if gamma is None :
0 commit comments