Class SparseLinearKernel
java.lang.Object
smile.math.kernel.SparseLinearKernel
- All Implemented Interfaces:
Serializable, ToDoubleBiFunction<SparseArray, SparseArray>, DotProductKernel, MercerKernel<SparseArray>, Function
public class SparseLinearKernel
extends Object
implements MercerKernel<SparseArray>, DotProductKernel
The linear dot product kernel on sparse arrays. When using a linear kernel, input space is
identical to feature space.
- See Also:
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble[]hi()Returns the upper bound of hyperparameters (in hyperparameter tuning).double[]Returns the hyperparameters of kernel.doublek(double dot) Computes the dot product kernel function.doublek(SparseArray x, SparseArray y) Kernel function.double[]kg(double dot) Computes the dot product kernel function and its gradient over hyperparameters.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.toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface DotProductKernel
apply, f, KMethods inherited from interface MercerKernel
apply, applyAsDouble, K, K, KG
-
Constructor Details
-
SparseLinearKernel
public SparseLinearKernel()Constructor.
-
-
Method Details
-
toString
-
k
public double k(double dot) Description copied from interface:DotProductKernelComputes the dot product kernel function.- Specified by:
kin interfaceDotProductKernel- Parameters:
dot- the dot product.- Returns:
- the kernel value.
-
kg
public double[] kg(double dot) Description copied from interface:DotProductKernelComputes the dot product kernel function and its gradient over hyperparameters.- Specified by:
kgin interfaceDotProductKernel- Parameters:
dot- The dot product.- Returns:
- the kernel value and gradient.
-
k
Description copied from interface:MercerKernelKernel function.- Specified by:
kin interfaceMercerKernel<SparseArray>- Parameters:
x- an object.y- an object.- Returns:
- the kernel value.
-
kg
Description copied from interface:MercerKernelComputes the kernel and its gradient over hyperparameters.- Specified by:
kgin interfaceMercerKernel<SparseArray>- Parameters:
x- an object.y- an object.- Returns:
- the kernel value and gradient.
-
of
Description copied from interface:MercerKernelReturns the same kind kernel with the new hyperparameters.- Specified by:
ofin interfaceMercerKernel<SparseArray>- Parameters:
params- the hyperparameters.- Returns:
- the same kind kernel with the new hyperparameters.
-
hyperparameters
public double[] hyperparameters()Description copied from interface:MercerKernelReturns the hyperparameters of kernel.- Specified by:
hyperparametersin interfaceMercerKernel<SparseArray>- Returns:
- the hyperparameters of kernel.
-
lo
public double[] lo()Description copied from interface:MercerKernelReturns the lower bound of hyperparameters (in hyperparameter tuning).- Specified by:
loin interfaceMercerKernel<SparseArray>- Returns:
- the lower bound of hyperparameters.
-
hi
public double[] hi()Description copied from interface:MercerKernelReturns the upper bound of hyperparameters (in hyperparameter tuning).- Specified by:
hiin interfaceMercerKernel<SparseArray>- Returns:
- the upper bound of hyperparameters.
-