Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.distance.distancefunction
Class KernelBasedLocallyWeightedDistanceFunction<V extends NumberVector<V,?>,P extends LocalPCAPreprocessor<V>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.logging.AbstractLoggable
      extended by de.lmu.ifi.dbs.elki.distance.AbstractMeasurementFunction<O,D>
          extended by de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractDistanceFunction<O,DoubleDistance>
              extended by de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractLocallyWeightedDistanceFunction<V,P>
                  extended by de.lmu.ifi.dbs.elki.distance.distancefunction.KernelBasedLocallyWeightedDistanceFunction<V,P>
Type Parameters:
V - the type of NumberVector to compute the distances in between
P - the type of Preprocessor used
All Implemented Interfaces:
DistanceFunction<V,DoubleDistance>, LocalPCAPreprocessorBasedDistanceFunction<V,P,DoubleDistance>, PreprocessorBasedDistanceFunction<V,P,DoubleDistance>, MeasurementFunction<V,DoubleDistance>, PreprocessorBasedMeasurementFunction<V,P,DoubleDistance>, PreprocessorClient<P,V>, Parameterizable

public class KernelBasedLocallyWeightedDistanceFunction<V extends NumberVector<V,?>,P extends LocalPCAPreprocessor<V>>
extends AbstractLocallyWeightedDistanceFunction<V,P>

Provides a kernel based locally weighted distance function. It is defined as follows: result = max{distP(P,Q), distQ(Q,P)}, where distP(P,Q) computes the quadratic form distance on the weak eigenvectors of the kernel matrix of P between two vectors P and Q in feature space. Computation of the distance component of the weak eigenvectors is done indirectly by computing the difference between the complete kernel distance and the distance component of the strong eigenvectors: distP(P,Q) = distP_weak(P,Q) = sqrt(distP_complete(P,Q)^2 - distP_strong(P,Q)^2) KP_complete(P,Q) is the kernel derived distance between P and Q. The distance component of the strong eigenvectors KP_strong(P,Q) is computed as follows: First, the vectors P and Q are projected onto the strong eigenvectors of the kernel matrix of P, which results in the two vectors Pp and Qp. Then, the euclidean distance is used to compute the distance between Pp and Qp. In case of the linear kernel function, this distance is identical to those computed by the LocallyWeightedDistanceFunction with parameters big = 1.0 and small = 0.0

Author:
Simon Paradies

Field Summary
static Class<?> DEFAULT_KERNEL_FUNCTION_CLASS
          The default kernel function.
static OptionID KERNEL_FUNCTION_ID
          OptionID for KERNEL_FUNCTION_PARAM
private  ObjectParameter<KernelFunction<V,DoubleDistance>> KERNEL_FUNCTION_PARAM
          Parameter for the kernel function
private  KernelFunction<V,DoubleDistance> kernelFunction
          The kernel function that is used.
private  KernelMatrix<V> kernelMatrix
          The global precomputed kernel matrix
 
Fields inherited from class de.lmu.ifi.dbs.elki.distance.AbstractMeasurementFunction
distanceFactory
 
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debug, logger
 
Constructor Summary
KernelBasedLocallyWeightedDistanceFunction(Parameterization config)
          Constructor, adhering to Parameterizable
 
Method Summary
private  double computeDistance(V v1, V v2)
          Computes the distance between two given real vectors according to this distance function.
 DoubleDistance distance(V v1, V v2)
          Computes the distance between two given DatabaseObjects according to this distance function.
 AssociationID<Matrix> getAssociationID()
          Returns the association ID for the association to be set by the preprocessor.
 void setDatabase(Database<V> database)
          Set the database that holds the associations for the DatabaseObject for which the measurements should be computed.
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractLocallyWeightedDistanceFunction
getDefaultPreprocessorClass, getPreprocessorDescription, getPreprocessorSuperClass
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractDistanceFunction
distance, distance
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.AbstractMeasurementFunction
getDatabase, getDistanceFactory, infiniteDistance, nullDistance, undefinedDistance, valueOf
 
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debugFine, debugFiner, debugFinest, exception, progress, verbose, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.distance.distancefunction.DistanceFunction
distance, distance
 
Methods inherited from interface de.lmu.ifi.dbs.elki.distance.MeasurementFunction
getDistanceFactory, infiniteDistance, nullDistance, undefinedDistance, valueOf
 

Field Detail

DEFAULT_KERNEL_FUNCTION_CLASS

public static final Class<?> DEFAULT_KERNEL_FUNCTION_CLASS
The default kernel function.


KERNEL_FUNCTION_ID

public static final OptionID KERNEL_FUNCTION_ID
OptionID for KERNEL_FUNCTION_PARAM


KERNEL_FUNCTION_PARAM

private ObjectParameter<KernelFunction<V extends NumberVector<V,?>,DoubleDistance>> KERNEL_FUNCTION_PARAM
Parameter for the kernel function


kernelFunction

private KernelFunction<V extends NumberVector<V,?>,DoubleDistance> kernelFunction
The kernel function that is used.


kernelMatrix

private KernelMatrix<V extends NumberVector<V,?>> kernelMatrix
The global precomputed kernel matrix

Constructor Detail

KernelBasedLocallyWeightedDistanceFunction

public KernelBasedLocallyWeightedDistanceFunction(Parameterization config)
Constructor, adhering to Parameterizable

Parameters:
config - Parameterization
Method Detail

distance

public DoubleDistance distance(V v1,
                               V v2)
Computes the distance between two given DatabaseObjects according to this distance function.

Parameters:
v1 - first DatabaseObject
v2 - second DatabaseObject
Returns:
the distance between two given DatabaseObjects according to this distance function

computeDistance

private double computeDistance(V v1,
                               V v2)
Computes the distance between two given real vectors according to this distance function.

Parameters:
v1 - first FeatureVector
v2 - second FeatureVector
Returns:
the distance between two given real vectors according to this distance function

setDatabase

public void setDatabase(Database<V> database)
Description copied from interface: MeasurementFunction
Set the database that holds the associations for the DatabaseObject for which the measurements should be computed.

Specified by:
setDatabase in interface MeasurementFunction<V extends NumberVector<V,?>,DoubleDistance>
Overrides:
setDatabase in class AbstractLocallyWeightedDistanceFunction<V extends NumberVector<V,?>,P extends LocalPCAPreprocessor<V>>
Parameters:
database - Database

getAssociationID

public AssociationID<Matrix> getAssociationID()
Returns the association ID for the association to be set by the preprocessor.

Returns:
the association ID for the association to be set by the preprocessor, which is AssociationID.STRONG_EIGENVECTOR_MATRIX .

Release 0.3 (2010-03-31_1612)