fr.lip6.kernel
Class CMKernel<T>

java.lang.Object
  extended by fr.lip6.kernel.Kernel<T>
      extended by fr.lip6.kernel.CMKernel<T>
Type Parameters:
T -
All Implemented Interfaces:
java.io.Serializable

public class CMKernel<T>
extends Kernel<T>

Generic kernel with a matrix based cache policy.
The Gram matrix associated with an list of TrainingSample is cached for future requests.

Author:
dpicard
See Also:
Serialized Form

Field Summary
 
Fields inherited from class fr.lip6.kernel.Kernel
name
 
Constructor Summary
CMKernel(Kernel<T> k)
          Default constructor
 
Method Summary
 double[][] getKernelMatrix(java.util.ArrayList<TrainingSample<T>> e)
          return the Gram Matrix of this kernel computed on given samples
 double valueOf(T t1)
          kernel similarity to zero
 double valueOf(T t1, T t2)
          compute the kernel similarity between two element of input space
 
Methods inherited from class fr.lip6.kernel.Kernel
getNormalizedKernelMatrix, normalizedValueOf, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CMKernel

public CMKernel(Kernel<T> k)
Default constructor

Parameters:
k - the kernel to cache
Method Detail

getKernelMatrix

public double[][] getKernelMatrix(java.util.ArrayList<TrainingSample<T>> e)
Description copied from class: Kernel
return the Gram Matrix of this kernel computed on given samples

Overrides:
getKernelMatrix in class Kernel<T>
Returns:
double[][] containing similarities in the order of the e.

valueOf

public double valueOf(T t1,
                      T t2)
Description copied from class: Kernel
compute the kernel similarity between two element of input space

Specified by:
valueOf in class Kernel<T>
Parameters:
t1 - first element
t2 - second element
Returns:
the kernel value

valueOf

public double valueOf(T t1)
Description copied from class: Kernel
kernel similarity to zero

Specified by:
valueOf in class Kernel<T>
Parameters:
t1 - the element to compute the similarity to zero