Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weka.classifiers.functions.supportVector
Class CachedKernel

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

All Implemented Interfaces:
  java.io.Serializable

Direct Known Subclasses:
  PolyKernel, RBFKernel

    public abstract class CachedKernel

extends Kernel

Base class for RBFKernel and PolyKernel that implements a simple LRU. (least-recently-used) cache if the cache size is set to a value > 0. Otherwise it uses a full cache.

Version:
  $Revision: 1.1.2.4 $
Author:
  Eibe Frank (eibe@cs.waikato.ac.nz), Shane Legg (shane@intelligenesis.net) (sparse vector code), Stuart Inglis (stuart@reeltwo.com) (sparse vector code), J. Lindgren (jtlindgr{at}cs.helsinki.fi) (RBF kernel), Steven Hugg (hugg@fasterlight.com) (refactored, LRU cache), Bernhard Pfahringer (bernhard@cs.waikato.ac.nz) (full cache)
See Also:
  Serialized Form

Method Summary
`void` | `clean()` Frees the cache used by the kernel.
`double` | `eval(int id1, int id2, Instance inst1)` Implements the abstract function of Kernel using the cache.
`int` | `numCacheHits()` Returns the number of cache hits on dot products.
`int` | `numEvals()` Returns the number of time Eval has been called.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### eval

    public double eval(int id1,
                       int id2,
                       Instance inst1)
                throws java.lang.Exception

  Implements the abstract function of Kernel using the cache. This method uses the evaluate() method to do the actual dot product.

  Specified by:
    `eval` in class `Kernel`
  Parameters:
    `id1` - the index of the first instance in the dataset
    `id2` - the index of the second instance in the dataset
  Returns:
    the result of the kernel function
  Throws:
    `java.lang.Exception`

### numEvals

    public int numEvals()

  Returns the number of time Eval has been called.

  Specified by:
    `numEvals` in class `Kernel`
  Returns:
    the number of kernel evaluation.

### numCacheHits

    public int numCacheHits()

  Returns the number of cache hits on dot products.

  Specified by:
    `numCacheHits` in class `Kernel`
  Returns:
    the number of cache hits.

### clean

    public void clean()

  Frees the cache used by the kernel.

  Specified by:
    `clean` in class `Kernel`

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD