Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

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

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.logging.AbstractLoggable
      extended by de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
          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.AbstractDoubleDistanceFunction<O>
                      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 RealVector to compute the distances in between
P - the type of Preprocessor used
All Implemented Interfaces:
DistanceFunction<V,DoubleDistance>, MeasurementFunction<V,DoubleDistance>, PreprocessorClient<P,V>, Parameterizable

public class KernelBasedLocallyWeightedDistanceFunction<V extends RealVector<V,?>,P extends Preprocessor<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 String DEFAULT_KERNEL_FUNCTION_CLASS
          The default kernel function.
static OptionID KERNEL_FUNCTION_ID
          OptionID for KERNEL_FUNCTION_PARAM
(package private)  ClassParameter<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
INFINITY_PATTERN
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
optionHandler
 
Fields inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debug, logger
 
Constructor Summary
KernelBasedLocallyWeightedDistanceFunction()
          Provides a kernel based locally weighted distance function.
 
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, boolean verbose, boolean time)
          Set the database that holds the associations for the DatabaseObject for which the measurements should be computed.
 List<String> setParameters(List<String> args)
          Calls AbstractParameterizable#setParameters and passes the remaining parameters to the AbstractLocallyWeightedDistanceFunction.preprocessorHandler.
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractLocallyWeightedDistanceFunction
getDefaultPreprocessorClassName, getPreprocessorDescription, getPreprocessorSuperClass, shortDescription
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractDoubleDistanceFunction
infiniteDistance, nullDistance, undefinedDistance, valueOf
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractDistanceFunction
distance, distance, isInfiniteDistance, isNullDistance, isUndefinedDistance
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.AbstractMeasurementFunction
getDatabase, matches, requiredInputPattern, setRequiredInputPattern
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
addOption, addParameterizable, addParameterizable, checkGlobalParameterConstraints, collectOptions, getAttributeSettings, getParameters, rememberParametersExcept, removeOption, removeParameterizable
 
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.utilities.optionhandling.Parameterizable
checkGlobalParameterConstraints, collectOptions, getParameters
 
Methods inherited from interface de.lmu.ifi.dbs.elki.distance.MeasurementFunction
requiredInputPattern
 

Field Detail

DEFAULT_KERNEL_FUNCTION_CLASS

public static final String 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

ClassParameter<KernelFunction<V extends RealVector<V,?>,DoubleDistance>> KERNEL_FUNCTION_PARAM
Parameter for the kernel function


kernelFunction

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


kernelMatrix

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

Constructor Detail

KernelBasedLocallyWeightedDistanceFunction

public KernelBasedLocallyWeightedDistanceFunction()
Provides a kernel based locally weighted distance function.

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

setParameters

public List<String> setParameters(List<String> args)
                           throws ParameterException
Description copied from class: AbstractLocallyWeightedDistanceFunction
Calls AbstractParameterizable#setParameters and passes the remaining parameters to the AbstractLocallyWeightedDistanceFunction.preprocessorHandler.

Specified by:
setParameters in interface Parameterizable
Overrides:
setParameters in class AbstractLocallyWeightedDistanceFunction<V extends RealVector<V,?>,P extends Preprocessor<V>>
Parameters:
args - parameters to set the attributes accordingly to
Returns:
a list containing the unused parameters
Throws:
ParameterException - in case of wrong parameter-setting

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,
                        boolean verbose,
                        boolean time)
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 RealVector<V,?>,DoubleDistance>
Overrides:
setDatabase in class AbstractLocallyWeightedDistanceFunction<V extends RealVector<V,?>,P extends Preprocessor<V>>
Parameters:
database - Database
verbose - unused
time - unused

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.2.1 (2009-07-13_1605)