Package smile.math.kernel
Class SparseMaternKernel
java.lang.Object
smile.math.kernel.Matern
smile.math.kernel.SparseMaternKernel
- All Implemented Interfaces:
Serializable
,ToDoubleBiFunction<SparseArray,
,SparseArray> Function
,IsotropicKernel
,MercerKernel<SparseArray>
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
ConstructorDescriptionSparseMaternKernel
(double sigma, double nu) Constructor.SparseMaternKernel
(double sigma, double nu, double lo, double hi) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]
hi()
Returns the upper bound of hyperparameters (in hyperparameter tuning).double[]
Returns the hyperparameters of kernel.double
k
(SparseArray x, SparseArray y) Kernel function.double[]
kg
(SparseArray x, SparseArray y) Computes the kernel and its gradient over hyperparameters.double[]
lo()
Returns the lower bound of hyperparameters (in hyperparameter tuning).of
(double[] params) Returns the same kind kernel with the new hyperparameters.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
Methods inherited from interface smile.math.kernel.MercerKernel
apply, applyAsDouble, K, K, KG
-
Constructor Details
-
SparseMaternKernel
public SparseMaternKernel(double sigma, double nu) 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.
-
SparseMaternKernel
public SparseMaternKernel(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
-
k
Description copied from interface:MercerKernel
Kernel function.- Specified by:
k
in interfaceMercerKernel<SparseArray>
- Parameters:
x
- an object.y
- an object.- Returns:
- the kernel value.
-
kg
Description copied from interface:MercerKernel
Computes the kernel and its gradient over hyperparameters.- Specified by:
kg
in interfaceMercerKernel<SparseArray>
- Parameters:
x
- an object.y
- an object.- Returns:
- the kernel value and gradient.
-
of
Description copied from interface:MercerKernel
Returns the same kind kernel with the new hyperparameters.- Specified by:
of
in interfaceMercerKernel<SparseArray>
- Parameters:
params
- the hyperparameters.- Returns:
- the same kind kernel with the new hyperparameters.
-
hyperparameters
public double[] hyperparameters()Description copied from interface:MercerKernel
Returns the hyperparameters of kernel.- Specified by:
hyperparameters
in interfaceMercerKernel<SparseArray>
- Returns:
- the hyperparameters of kernel.
-
lo
public double[] lo()Description copied from interface:MercerKernel
Returns the lower bound of hyperparameters (in hyperparameter tuning).- Specified by:
lo
in interfaceMercerKernel<SparseArray>
- Returns:
- the lower bound of hyperparameters.
-
hi
public double[] hi()Description copied from interface:MercerKernel
Returns the upper bound of hyperparameters (in hyperparameter tuning).- Specified by:
hi
in interfaceMercerKernel<SparseArray>
- Returns:
- the upper bound of hyperparameters.
-