com.aliasi.matrix
Class HyperbolicTangentKernel

java.lang.Object
  extended by com.aliasi.matrix.HyperbolicTangentKernel
All Implemented Interfaces:
KernelFunction, Proximity<Vector>, Serializable

public class HyperbolicTangentKernel
extends Object
implements KernelFunction, Serializable

A HyperbolicTangentKernel provides a kernel based on the hyperbolic tangent of a dot product with fixed linear scaling. Hyperbolic tangent kernels are popular as neural network activation functions.

The hyperbolic tangent kernel function of with parameters k0 and k1 is defined between two vectors v1 and v2 of the same dimensionality by:

 kernel(v1,v2) = tanh(k1 * v1 * v2 + k0)
where v1 * v2 is the usual dot product and the constant k1 is simply a scalar multiplier.

References

Since:
LingPipe3.1
Version:
3.8
Author:
Bob Carpenter
See Also:
Serialized Form

Constructor Summary
HyperbolicTangentKernel(double k0, double k1)
          Construct a linearly offset hyperbolic tangent kernel with the specified slope and intercept parameters.
 
Method Summary
 double proximity(Vector v1, Vector v2)
          Returns the result of applying the hyperbolic tangent kernel function to to the specified vectors.
 String toString()
          Returns a string-based representation of this kernel function, including the offset and slope parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HyperbolicTangentKernel

public HyperbolicTangentKernel(double k0,
                               double k1)
Construct a linearly offset hyperbolic tangent kernel with the specified slope and intercept parameters.

Parameters:
k0 - Intercept parameter.
k1 - Slope parameter.
Throws:
IllegalArgumentException - If either of the parameters are not finite numbers, or if the k1 parameter is zero.
Method Detail

proximity

public double proximity(Vector v1,
                        Vector v2)
Returns the result of applying the hyperbolic tangent kernel function to to the specified vectors.

Specified by:
proximity in interface KernelFunction
Specified by:
proximity in interface Proximity<Vector>
Parameters:
v1 - First vector.
v2 - Second vector.
Returns:
Kernel function applied to the two vectors.
Throws:
IllegalArgumentException - If the vectors are not of the same dimensionality.

toString

public String toString()
Returns a string-based representation of this kernel function, including the offset and slope parameters.

Overrides:
toString in class Object
Returns:
A string representing this kernel.