
public class KernelMatrix extends Object
| Modifier and Type | Field and Description | 
|---|---|
| (package private) Matrix | kernelThe kernel matrix | 
| Constructor and Description | 
|---|
| KernelMatrix(double[][] matrixArray)Wraps the matrixArray in a KernelMatrix | 
| KernelMatrix(Matrix matrix)Makes a new kernel matrix from matrix (with data copying). | 
| KernelMatrix(PrimitiveSimilarityFunction<? super O,DoubleDistance> kernelFunction,
            Relation<? extends O> database)Deprecated. 
 ID mapping is not reliable! | 
| KernelMatrix(PrimitiveSimilarityFunction<? super O,DoubleDistance> kernelFunction,
            Relation<? extends O> database,
            ArrayDBIDs ids)Provides a new kernel matrix. | 
| Modifier and Type | Method and Description | 
|---|---|
| static Matrix | centerKernelMatrix(KernelMatrix kernelMatrix)Centers the Kernel Matrix in Feature Space according to Smola et. | 
| static Matrix | centerMatrix(Matrix matrix)Centers the matrix in feature space according to Smola et. | 
| double | getDistance(int o1,
           int o2)Returns the kernel distance between the two specified objects. | 
| Matrix | getKernel()Get the kernel matrix. | 
| double | getSimilarity(int o1,
             int o2)Returns the kernel value of object o1 and object o2 | 
| double | getSquaredDistance(int o1,
                  int o2)Returns the squared kernel distance between the two specified objects. | 
| Matrix | getSubColumn(int i,
            List<Integer> ids)Returns the ith kernel matrix column for all objects in ids | 
| Matrix | getSubMatrix(Collection<Integer> ids)Returns a sub kernel matrix for all objects in ids | 
| String | toString() | 
Matrix kernel
public KernelMatrix(double[][] matrixArray)
matrixArray - two dimensional double array@Deprecated public KernelMatrix(PrimitiveSimilarityFunction<? super O,DoubleDistance> kernelFunction, Relation<? extends O> database)
kernelFunction - the kernel function used to compute the kernel matrixdatabase - the database for which the kernel matrix is computedpublic KernelMatrix(PrimitiveSimilarityFunction<? super O,DoubleDistance> kernelFunction, Relation<? extends O> database, ArrayDBIDs ids)
kernelFunction - the kernel function used to compute the kernel matrixdatabase - the database that holds the objectsids - the IDs of those objects for which the kernel matrix is computedpublic KernelMatrix(Matrix matrix)
matrix - a matrixpublic double getDistance(int o1,
                 int o2)
o1 - first ObjectIDo2 - second ObjectIDpublic Matrix getKernel()
public double getSimilarity(int o1,
                   int o2)
o1 - ID of first objecto2 - ID of second objectpublic double getSquaredDistance(int o1,
                        int o2)
o1 - first ObjectIDo2 - second ObjectIDpublic Matrix getSubColumn(int i, List<Integer> ids)
i - the column which should be returnedids - the objectspublic Matrix getSubMatrix(Collection<Integer> ids)
ids - the objectspublic static Matrix centerMatrix(Matrix matrix)
centeredMatrix = centerKernelMatrix(uncenteredMatrix.copy()) {matrix - the matrix to be centeredpublic static Matrix centerKernelMatrix(KernelMatrix kernelMatrix)
centeredMatrix = centerKernelMatrix(uncenteredMatrix.copy()) {kernelMatrix - the kernel matrix to be centered