org.biojava.stats.svm
Class NormalizingKernel
java.lang.Object
org.biojava.stats.svm.NestedKernel
org.biojava.stats.svm.NormalizingKernel
- All Implemented Interfaces:
- java.io.Serializable, SVMKernel
public class NormalizingKernel
- extends NestedKernel
Performs a normalization on the results of a nested kernel.
This is equivalent to making the locations in feature space of the nested
kernel unit vectors lying on a unit sphere. The dot product in feature space
then becomes just cos theta
rather than
||a|| * ||b|| * cos theta
as both lengths are 1. The length of
a in the feature space of kernel k is sqrt( k(a, a) )
, so that
the normalizing kernel ends up calculating
k(a, b) / sqrt( k(a, a) * k(b, b) )
.
As the values of k(x, x) are required repeatedly, it may be worth making the
nested kernel a DiagonalCachingKernel.
- Author:
- Thomas Down, Matthew Pocock
- See Also:
- Serialized Form
Method Summary |
double |
evaluate(java.lang.Object a,
java.lang.Object b)
Return the dot product of two vectors in an arbitrary
feature space. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
NormalizingKernel
public NormalizingKernel()
NormalizingKernel
public NormalizingKernel(SVMKernel k)
evaluate
public double evaluate(java.lang.Object a,
java.lang.Object b)
- 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 java.lang.String toString()
- Overrides:
toString
in class java.lang.Object