com.aliasi.matrix
Class DotProductKernel

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

public class DotProductKernel
extends Object
implements KernelFunction, Serializable

The DotProductKernel is the trivial kernel function computed by taking the dot product of the input vectors. The dot-product kernel is, for instance, the kernel to use for the ordinary (non-kernel) perceptron. Typically, this kernel is used as a baseline, as polynomial and radial basis kernels tend to perform better in practice for classification and clustering problems.

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

Constructor Summary
DotProductKernel()
          Construct a dot-product kernel.
 
Method Summary
 double proximity(Vector v1, Vector v2)
          Returns the dot product of the input vectors.
 String toString()
          Returns a string-based representation of this kernel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DotProductKernel

public DotProductKernel()
Construct a dot-product kernel.

Method Detail

toString

public String toString()
Returns a string-based representation of this kernel.

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

proximity

public double proximity(Vector v1,
                        Vector v2)
Returns the dot product of the input vectors.

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