java.lang.Object
com.imsl.datamining.supportvectormachine.Kernel
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
LinearKernel, PolynomialKernel, RadialBasisKernel, SigmoidKernel

public abstract class Kernel extends Object implements Cloneable
Abstract class to specify a kernel function for support vector machines.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Kernel(int numberOfParameters)
    Creates a Kernel and specifies the number of kernel parameters for a specific Kernel.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract Kernel
    Returns a clone of this object.
    protected double
    dot(DataNode[] x, DataNode[] y)
    Calculates the dot product between two DataNode arrays.
    double[]
    Returns the kernel parameters.
    abstract double
    kernelFunction(DataNode[][] x, int i, int j)
    Abstract method to calculate the kernel function between two DataNode arrays.
    abstract double
    Abstract method to calculate the kernel function between two DataNode arrays.
    void
    setParameters(double... kParams)
    Sets the kernel parameters.

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Kernel

      protected Kernel(int numberOfParameters)
      Creates a Kernel and specifies the number of kernel parameters for a specific Kernel.
      Parameters:
      numberOfParameters - an int indicating the number of parameters this Kernel must have
  • Method Details

    • kernelFunction

      public abstract double kernelFunction(DataNode[] x, DataNode[] y)
      Abstract method to calculate the kernel function between two DataNode arrays.
      Parameters:
      x - a DataNode array
      y - a DataNode array
      Returns:
      a double, the kernel function evaluated at x and y
    • kernelFunction

      public abstract double kernelFunction(DataNode[][] x, int i, int j)
      Abstract method to calculate the kernel function between two DataNode arrays.
      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]
    • clone

      public abstract Kernel clone()
      Returns a clone of this object.
      Overrides:
      clone in class Object
      Returns:
      a Kernel which is a clone of this object
    • getParameters

      public double[] getParameters()
      Returns the kernel parameters.
      Returns:
      a double array containing the kernel parameters
    • setParameters

      public void setParameters(double... kParams)
      Sets the kernel parameters.

      Specific instances can override this method to test for proper values of the parameters.

      Parameters:
      kParams - a double array containing the parameters
    • dot

      protected double dot(DataNode[] x, DataNode[] y)
      Calculates the dot product between two DataNode arrays. The array lengths may be different.
      Parameters:
      x - a DataNode array
      y - a DataNode array
      Returns:
      a double, the dot product between x and y