Package smile.math.kernel
Class BinarySparseThinPlateSplineKernel
java.lang.Object
smile.math.kernel.ThinPlateSpline
smile.math.kernel.BinarySparseThinPlateSplineKernel
- All Implemented Interfaces:
Serializable
,ToDoubleBiFunction<int[],
,int[]> Function
,IsotropicKernel
,MercerKernel<int[]>
public class BinarySparseThinPlateSplineKernel
extends ThinPlateSpline
implements MercerKernel<int[]>
The Thin Plate Spline kernel on binary sparse data.
k(u, v) = (||u-v|| / σ)2 log (||u-v|| / σ)
where σ > 0
is the scale parameter of the kernel.
The kernel can work on sparse binary array as int[]
, which are the
indices of nonzero elements.
- See Also:
-
Constructor Summary
ConstructorDescriptionBinarySparseThinPlateSplineKernel
(double sigma) Constructor.BinarySparseThinPlateSplineKernel
(double sigma, 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
(int[] x, int[] y) Kernel function.double[]
kg
(int[] x, int[] 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 smile.math.kernel.ThinPlateSpline
k, kg, scale, 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, f, K, KG
Methods inherited from interface smile.math.kernel.MercerKernel
apply, applyAsDouble, K, K, KG
-
Constructor Details
-
BinarySparseThinPlateSplineKernel
public BinarySparseThinPlateSplineKernel(double sigma) Constructor.- Parameters:
sigma
- The length scale of kernel.
-
BinarySparseThinPlateSplineKernel
public BinarySparseThinPlateSplineKernel(double sigma, double lo, double hi) Constructor.- Parameters:
sigma
- The length scale of kernel.lo
- The lower bound of length scale for hyperparameter tuning.hi
- The upper bound of length scale for hyperparameter tuning.
-
-
Method Details
-
k
public double k(int[] x, int[] y) Description copied from interface:MercerKernel
Kernel function.- Specified by:
k
in interfaceMercerKernel<int[]>
- Parameters:
x
- an object.y
- an object.- Returns:
- the kernel value.
-
kg
public double[] kg(int[] x, int[] y) Description copied from interface:MercerKernel
Computes the kernel and its gradient over hyperparameters.- Specified by:
kg
in interfaceMercerKernel<int[]>
- 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<int[]>
- 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<int[]>
- 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<int[]>
- 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<int[]>
- Returns:
- the upper bound of hyperparameters.
-