weka.classifiers.functions.supportVector

## Class RBFKernel

- java.lang.Object
- - weka.classifiers.functions.supportVector.Kernel
  - - weka.classifiers.functions.supportVector.CachedKernel
    - - weka.classifiers.functions.supportVector.RBFKernel

- All Implemented Interfaces:
    java.io.Serializable, CapabilitiesHandler, OptionHandler, RevisionHandler

      public class RBFKernel
      extends CachedKernel

  The RBF kernel : K(x, y) = exp(-gamma*(x-y)^2)
  Valid options are:

       -C <num>
        The size of the cache (a prime number), 0 for full cache and
        -1 to turn it off.
        (default: 250007)

       -G <double>
        The value to use for the gamma parameter (default: 0.01).

       -output-debug-info
        Enables debugging output (if available) to be printed.
        (default: off)

  Version:
    $Revision: 14534 $
  Author:
    Eibe Frank (eibe@cs.waikato.ac.nz), Shane Legg (shane@intelligenesis.net) (sparse vector code), Stuart Inglis (stuart@reeltwo.com) (sparse vector code)
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RBFKernel()` default constructor - does nothing.
    `RBFKernel(Instances data, int cacheSize, double gamma)` Creates a new `RBFKernel` instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `buildKernel(Instances data)` Builds the kernel.
    `java.lang.String` | `gammaTipText()` Returns the tip text for this property
    `Capabilities` | `getCapabilities()` Returns the Capabilities of this kernel.
    `double` | `getGamma()` Gets the gamma value.
    `java.lang.String` | `getRevision()` Returns the revision string.
    `java.lang.String` | `globalInfo()` Returns a string describing the kernel
    `void` | `setGamma(double value)` Sets the gamma value.
    `java.lang.String` | `toString()` returns a string representation for the Kernel

    - ### Methods inherited from class weka.classifiers.functions.supportVector.CachedKernel

      `cacheSizeTipText, clean, eval, getCacheSize, getOptions, listOptions, numCacheHits, numEvals, setCacheSize, setOptions`

    - ### Methods inherited from class weka.classifiers.functions.supportVector.Kernel

      `debugTipText, forName, getChecksTurnedOff, getDebug, getDoNotCheckCapabilities, makeCopies, makeCopy, setChecksTurnedOff, setDebug, setDoNotCheckCapabilities`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### RBFKernel

          public RBFKernel()

      default constructor - does nothing.

    - #### RBFKernel

          public RBFKernel(Instances data,
                           int cacheSize,
                           double gamma)
                    throws java.lang.Exception

      Creates a new `RBFKernel` instance.
      Parameters:
        `data` - the training dataset used.
        `cacheSize` - the size of the cache (a prime number)
        `gamma` - the gamma to use
      Throws:
        `java.lang.Exception` - if something goes wrong

  - ### Method Detail

    - #### buildKernel

          public void buildKernel(Instances data)
                           throws java.lang.Exception

      Builds the kernel. Calls the super class method and then also initializes the cache for the diagonal of the dot product matrix.
      Overrides:
        `buildKernel` in class `CachedKernel`
      Parameters:
        `data` - the data to base the kernel on
      Throws:
        `java.lang.Exception` - if something goes wrong

    - #### globalInfo

          public java.lang.String globalInfo()

      Returns a string describing the kernel
      Specified by:
        `globalInfo` in class `Kernel`
      Returns:
        a description suitable for displaying in the explorer/experimenter gui

    - #### getCapabilities

          public Capabilities getCapabilities()

      Returns the Capabilities of this kernel.
      Specified by:
        `getCapabilities` in interface `CapabilitiesHandler`
      Overrides:
        `getCapabilities` in class `Kernel`
      Returns:
        the capabilities of this object
      See Also:
        `Capabilities`

    - #### setGamma

          @OptionMetadata(description="The value to use for the gamma parameter (default: 0.01).",
                          displayName="gamma",
                          commandLineParamName="G",
                          commandLineParamSynopsis="-G <double>",
                          displayOrder=1)
          public void setGamma(double value)

      Sets the gamma value.
      Parameters:
        `value` - the gamma value

    - #### getGamma

          public double getGamma()

      Gets the gamma value.
      Returns:
        the gamma value

    - #### gammaTipText

          public java.lang.String gammaTipText()

      Returns the tip text for this property
      Returns:
        tip text for this property suitable for displaying in the explorer/experimenter gui

    - #### toString

          public java.lang.String toString()

      returns a string representation for the Kernel
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a string representaiton of the kernel

    - #### getRevision

          public java.lang.String getRevision()

      Returns the revision string.
      Specified by:
        `getRevision` in interface `RevisionHandler`
      Overrides:
        `getRevision` in class `Kernel`
      Returns:
        the revision