fr.lip6.kernel
Class ThreadedKernel<T>

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

public class ThreadedKernel<T>
extends Kernel<T>

Simple multithreaded implementation over a given Kernel. The multithreading comes only when computing the Gram matrix.
Number of Threads is function of available processors.

Author:
dpicard
See Also:
Serialized Form

Field Summary
protected  Kernel<T> k
           
protected  int numThread
           
 
Fields inherited from class fr.lip6.kernel.Kernel
name
 
Constructor Summary
ThreadedKernel(Kernel<T> kernel)
          MultiThread the given kernel
 
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
 

Field Detail

numThread

protected int numThread

k

protected Kernel<T> k
Constructor Detail

ThreadedKernel

public ThreadedKernel(Kernel<T> kernel)
MultiThread the given kernel

Parameters:
kernel -
Method Detail

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

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.