Class PolynomialKernel

java.lang.Object
com.imsl.datamining.supportvectormachine.Kernel
com.imsl.datamining.supportvectormachine.PolynomialKernel
All Implemented Interfaces:
Cloneable

public class PolynomialKernel extends Kernel
Specifies the polynomial kernel for support vector machines.

The kernel function at two data nodes, \(x_i\) and \(x_j\), is given by \(K(x_i , x_j) = (\gamma x_i^Tx_j + r)^d\), where \(\gamma \gt 0\), \(r\), and \(d > 0 \) are configurable parameters.

  • Constructor Details

    • PolynomialKernel

      public PolynomialKernel()
      Constructor for the polynomial kernel.

      The default values for the polynomial kernel are \(\gamma\)=1.0, r=0.0, and degree=1.

    • PolynomialKernel

      public PolynomialKernel(PolynomialKernel polyKernel)
      Constructs a copy of the input PolynomialKernel kernel.
      Parameters:
      polyKernel - a PolynomialKernel kernel
    • PolynomialKernel

      public PolynomialKernel(double gamma, double r, int degree)
      Constructs a polynomial kernel.
      Parameters:
      gamma - a double, the polynomial kernel free parameter
      r - a double, the soft margin cost function parameter
      degree - a double, the degree of the polynomial kernel
  • Method Details

    • clone

      public PolynomialKernel clone()
      Clones a PolynomialKernel kernel.
      Specified by:
      clone in class Kernel
      Returns:
      a clone of the PolynomialKernel kernel
    • setParameters

      public void setParameters(double... kParams)
      Sets the parameters for the polynomial kernel.
      Overrides:
      setParameters in class Kernel
      Parameters:
      kParams - a double array of length 3 containing parameter values: kParams[0]=\(\gamma\), kParams[1]=r, and kParams[2]=d.

      Default: kParams[0]=\(\gamma\)=1.0, kParams[1]=r=0, and kParams[2]=d=1.

    • kernelFunction

      public double kernelFunction(DataNode[] x, DataNode[] y)
      Calculates the kernel function between two DataNodes.
      Specified by:
      kernelFunction in class Kernel
      Parameters:
      x - a DataNode array
      y - a DataNode array
      Returns:
      a double, the kernel function evaluated at x and y
    • kernelFunction

      public double kernelFunction(DataNode[][] x, int i, int j)
      Calculates the kernel function between two DataNodes.
      Specified by:
      kernelFunction in class Kernel
      Parameters:
      x - a DataNode matrix
      i - an int, the index of the first DataNode, x[i]
      j - an int, the index of the second DataNode, x[j]
      Returns:
      a double, the kernel function evaluated at x[i] and x[j]