com.aliasi.matrix
Class PolynomialKernel

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

public class PolynomialKernel
extends Object
implements KernelFunction, Serializable

A PolynomialKernel provides a dot product over a fixed degree polynomial basis expansion of a vector.

The polynomial kernel of degree d over vectors v1 and v2 is defined in terms of underlying vector dot products:

 kernel(v1,v2) = (1 + v1 * v2)d
where v1 * v2 is shorthand for the method call v1.dotProduct(v2).

Serialization

A polynomial kernel may be serialized.

Background Reading

A thorough discussion of kernel functions and kernel-based classifiers may be found in:

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

Constructor Summary
PolynomialKernel(int degree)
          Construct a polynomial kernel function of the specified degree.
 
Method Summary
 double proximity(Vector v1, Vector v2)
          Returns the result of applying the polynomial kernel of this class's degree to the specified vectors.
 String toString()
          Returns a string-based representation of this kernel function, including the kernel type and degree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PolynomialKernel

public PolynomialKernel(int degree)
Construct a polynomial kernel function of the specified degree.

Parameters:
degree - Degree of the polynomial kernel.
Method Detail

proximity

public double proximity(Vector v1,
                        Vector v2)
Returns the result of applying the polynomial kernel of this class's degree 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:
Polynomial 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 kernel type and degree.

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