Package smile.math.kernel
Class Matern
java.lang.Object
smile.math.kernel.Matern
- All Implemented Interfaces:
Serializable
,Function
,IsotropicKernel
- Direct Known Subclasses:
BinarySparseMaternKernel
,MaternKernel
,SparseMaternKernel
The class of Matérn kernels is a generalization of the Gaussian/RBF.
It has an additional parameter nu which controls the smoothness of
the kernel function. The smaller nu, the less smooth the approximated
function is. As
nu -> inf
, the kernel becomes equivalent to the
Gaussian/RBF kernel. When nu = 1/2, the kernel becomes identical to the
Laplacian kernel. The Matern kernel become especially simple
when nu is half-integer. Important intermediate values are 3/2
(once differentiable functions) and 5/2 (twice differentiable functions).- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble
f
(double dist) Computes the value of the function at x.double
k
(double dist) Computes the isotropic kernel function.double[]
kg
(double dist) Computes the isotropic kernel function and its gradient over hyperparameters.double
scale()
Returns the length scale of kernel.double
Returns the smoothness of kernel.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface smile.math.kernel.IsotropicKernel
apply, K, KG
-
Constructor Details
-
Matern
public Matern(double sigma, double nu, double lo, double hi) Constructor.- Parameters:
sigma
- The length scale of kernel.nu
- The smoothness of the kernel function. Only 0.5, 1.5, 2.5 and Inf are accepted. The smoothness parameter is fixed during hyperparameter for tuning.lo
- The lower bound of length scale for hyperparameter tuning.hi
- The upper bound of length scale for hyperparameter tuning.
-
-
Method Details
-
scale
public double scale()Returns the length scale of kernel.- Returns:
- the length scale of kernel.
-
smoothness
public double smoothness()Returns the smoothness of kernel.- Returns:
- the smoothness of kernel.
-
toString
-
f
public double f(double dist) Description copied from interface:Function
Computes the value of the function at x.- Specified by:
f
in interfaceFunction
- Specified by:
f
in interfaceIsotropicKernel
- Parameters:
dist
- a real number.- Returns:
- the function value.
-
k
public double k(double dist) Description copied from interface:IsotropicKernel
Computes the isotropic kernel function.- Specified by:
k
in interfaceIsotropicKernel
- Parameters:
dist
- The distance.- Returns:
- the kernel value.
-
kg
public double[] kg(double dist) Description copied from interface:IsotropicKernel
Computes the isotropic kernel function and its gradient over hyperparameters.- Specified by:
kg
in interfaceIsotropicKernel
- Parameters:
dist
- The distance.- Returns:
- the kernel value and gradient.
-