public class KernelMatrix
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static interface |
KernelMatrix.DBIDMap
Map a DBID to its offset
TODO: move to shared code.
|
private class |
KernelMatrix.RangeMap
Map a DBID to an integer offset, DBIDRange version.
|
private class |
KernelMatrix.SortedArrayMap
Map a DBID to an integer offset, Version to support arbitrary DBIDs.
|
Modifier and Type | Field and Description |
---|---|
(package private) KernelMatrix.DBIDMap |
idmap
Static mapping from DBIDs to indexes.
|
(package private) double[][] |
kernel
The kernel matrix
|
Constructor and Description |
---|
KernelMatrix(double[][] matrix)
Makes a new kernel matrix from matrix (with data copying).
|
KernelMatrix(PrimitiveSimilarityFunction<? super O> kernelFunction,
Relation<? extends O> relation,
DBIDs ids)
Provides a new kernel matrix.
|
KernelMatrix(SimilarityQuery<? super O> kernelFunction,
Relation<? extends O> relation,
DBIDs ids)
Provides a new kernel matrix.
|
Modifier and Type | Method and Description |
---|---|
static double[][] |
centerKernelMatrix(KernelMatrix kernelMatrix)
Centers the Kernel Matrix in Feature Space according to Smola et.
|
static double[][] |
centerMatrix(double[][] matrix)
Centers the matrix in feature space according to Smola et Schoelkopf,
Learning with Kernels p. 431 Alters the input matrix.
|
double |
getDistance(DBIDRef o1,
DBIDRef o2)
Returns the kernel distance between the two specified objects.
|
double[][] |
getKernel()
Get the kernel matrix.
|
double |
getSimilarity(DBIDRef id1,
DBIDRef id2)
Get the kernel similarity for the given objects.
|
double |
getSquaredDistance(DBIDRef id1,
DBIDRef id2)
Returns the squared kernel distance between the two specified objects.
|
double[][] kernel
KernelMatrix.DBIDMap idmap
public KernelMatrix(PrimitiveSimilarityFunction<? super O> kernelFunction, Relation<? extends O> relation, DBIDs ids)
kernelFunction
- the kernel function used to compute the kernel matrixrelation
- the database that holds the objectsids
- the IDs of those objects for which the kernel matrix is computedpublic KernelMatrix(SimilarityQuery<? super O> kernelFunction, Relation<? extends O> relation, DBIDs ids)
kernelFunction
- the kernel function used to compute the kernel matrixrelation
- the database that holds the objectsids
- the IDs of those objects for which the kernel matrix is computedpublic KernelMatrix(double[][] matrix)
matrix
- a matrixpublic double getDistance(DBIDRef o1, DBIDRef o2)
o1
- first ObjectIDo2
- second ObjectIDpublic double[][] getKernel()
public double getSquaredDistance(DBIDRef id1, DBIDRef id2)
id1
- first ObjectIDid2
- second ObjectIDpublic static double[][] centerMatrix(double[][] matrix)
centeredMatrix = centerKernelMatrix(uncenteredMatrix.copy()) {
matrix
- the matrix to be centeredpublic static double[][] centerKernelMatrix(KernelMatrix kernelMatrix)
centeredMatrix = centerKernelMatrix(uncenteredMatrix.copy()) {
kernelMatrix
- the kernel matrix to be centeredCopyright © 2019 ELKI Development Team. License information.