## org.biojava.stats.svm
Class CachingKernel

    java.lang.Object
      org.biojava.stats.svm.NestedKernel
          org.biojava.stats.svm.CachingKernel

All Implemented Interfaces:
  Serializable, SVMKernel

    public class CachingKernel

extends NestedKernel

Caches the results of a nested kernel so that k(a, b) need only be calculated once.

This kernel is thread-safe. However, care must be taken when setting the nested kernel that no other thread is retrieving values at the same time. This would cause a race condition in which the newly flushed cache may contain a value from the previous kernel.

Author:
  Thomas Down, Matthew Pocock
See Also:
  Serialized Form

Constructor Summary
`CachingKernel()`
`CachingKernel(SVMKernel k)`

Method Summary
`double` `evaluate(Object x, Object y)` Return the dot product of two vectors in an arbitrary feature space.
`void` `setNestedKernel(SVMKernel k)` Set the SVMKernel to nest to k.
`String` `toString()`

Methods inherited from class org.biojava.stats.svm.NestedKernel
`getNestedKernel`

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

Constructor Detail

### CachingKernel

    public CachingKernel()

### CachingKernel

    public CachingKernel(SVMKernel k)

Method Detail

### setNestedKernel

    public void setNestedKernel(SVMKernel k)

  Description copied from class: `NestedKernel`
  Set the SVMKernel to nest to k.

  Overrides:
    `setNestedKernel` in class `NestedKernel`
  Parameters:
    `k` - the SVMKernel to nest.

### evaluate

    public double evaluate(Object x,
                           Object y)

  Description copied from interface: `SVMKernel`
  Return the dot product of two vectors in an arbitrary feature space. In this implementation, the `vectors' can actually be arbitrary objects.

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`