Package smile.math.kernel
Class HellingerKernel
java.lang.Object
smile.math.kernel.HellingerKernel
- All Implemented Interfaces:
Serializable
,ToDoubleBiFunction<double[],
,double[]> MercerKernel<double[]>
The Hellinger kernel. The Hellinger distance is used to quantify the
similarity between two probability distributions. It is a type of
f-divergence. The Hellinger distance H(P, Q) on discrete distributions
is equivalent to the Euclidean distance of the square root vectors.
The Hellinger kernel is 1 - H2(P, Q), which is equivalent
to the dot product of the square root vectors.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondouble[]
hi()
Returns the upper bound of hyperparameters (in hyperparameter tuning).double[]
Returns the hyperparameters of kernel.double
k
(double[] x, double[] y) Kernel function.double[]
kg
(double[] x, double[] 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface smile.math.kernel.MercerKernel
apply, applyAsDouble, K, K, KG
-
Constructor Details
-
HellingerKernel
public HellingerKernel()Constructor.
-
-
Method Details
-
toString
-
k
public double k(double[] x, double[] y) Description copied from interface:MercerKernel
Kernel function.- Specified by:
k
in interfaceMercerKernel<double[]>
- Parameters:
x
- an object.y
- an object.- Returns:
- the kernel value.
-
kg
public double[] kg(double[] x, double[] y) Description copied from interface:MercerKernel
Computes the kernel and its gradient over hyperparameters.- Specified by:
kg
in interfaceMercerKernel<double[]>
- 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<double[]>
- 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<double[]>
- 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<double[]>
- 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<double[]>
- Returns:
- the upper bound of hyperparameters.
-