public class BinarySparseHyperbolicTangentKernel extends HyperbolicTangent implements MercerKernel<int[]>
k(u, v) = tanh(γ uTv - λ)
where γ is the scale of the used inner product and λ is
the offset of the used inner product. If the offset is negative the
likelihood of obtaining a kernel matrix that is not positive definite
is much higher (since then even some diagonal elements may be negative),
hence if this kernel has to be used, the offset should always be positive.
Note, however, that this is no guarantee that the kernel will be positive.
The hyperbolic tangent kernel was quite popular for support vector machines due to its origin from neural networks. However, it should be used carefully since the kernel matrix may not be positive semi-definite. Besides, it was reported the hyperbolic tangent kernel is not better than the Gaussian kernel in general.
The kernel works sparse binary array as int[], which are the indices of nonzero elements.
| Constructor and Description |
|---|
BinarySparseHyperbolicTangentKernel()
Constructor with scale 1.0 and offset 0.0.
|
BinarySparseHyperbolicTangentKernel(double scale,
double offset)
Constructor.
|
BinarySparseHyperbolicTangentKernel(double scale,
double offset,
double[] lo,
double[] hi)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
double[] |
hi()
Returns the upper bound of hyperparameters.
|
double[] |
hyperparameters()
Returns the hyperparameters for tuning.
|
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.
|
BinarySparseHyperbolicTangentKernel |
of(double[] params)
Returns the same kind kernel with the new hyperparameters.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitapply, applyAsDouble, K, K, KGapply, f, Kpublic BinarySparseHyperbolicTangentKernel()
public BinarySparseHyperbolicTangentKernel(double scale,
double offset)
scale - The scale parameter.offset - The offset parameter.public BinarySparseHyperbolicTangentKernel(double scale,
double offset,
double[] lo,
double[] hi)
scale - The scale parameter.offset - The offset parameter.lo - The lower bound of scale and offset for hyperparameter tuning.hi - The upper bound of scale and offset for hyperparameter tuning.public double k(int[] x,
int[] y)
MercerKernelk in interface MercerKernel<int[]>public double[] kg(int[] x,
int[] y)
MercerKernelkg in interface MercerKernel<int[]>public BinarySparseHyperbolicTangentKernel of(double[] params)
MercerKernelof in interface MercerKernel<int[]>public double[] hyperparameters()
MercerKernelhyperparameters in interface MercerKernel<int[]>public double[] lo()
MercerKernello in interface MercerKernel<int[]>public double[] hi()
MercerKernelhi in interface MercerKernel<int[]>