Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.distance.distancefunction.correlation
Class PCABasedCorrelationDistanceFunction<V extends RealVector<V,?>,P extends HiCOPreprocessor<V>,D extends CorrelationDistance<D>>

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,D>
                  extended by de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractPreprocessorBasedDistanceFunction<V,P,D>
                      extended by de.lmu.ifi.dbs.elki.distance.distancefunction.correlation.AbstractCorrelationDistanceFunction<V,P,D>
                          extended by de.lmu.ifi.dbs.elki.distance.distancefunction.correlation.PCABasedCorrelationDistanceFunction<V,P,D>
Type Parameters:
V - the type of RealVector to compute the distances in between
P - the type of Preprocessor used
D - the type of CorrelationDistance used
All Implemented Interfaces:
DistanceFunction<V,D>, MeasurementFunction<V,D>, PreprocessorBasedMeasurementFunction<V,P,D>, PreprocessorClient<P,V>, Parameterizable

public class PCABasedCorrelationDistanceFunction<V extends RealVector<V,?>,P extends HiCOPreprocessor<V>,D extends CorrelationDistance<D>>
extends AbstractCorrelationDistanceFunction<V,P,D>

Provides the correlation distance for real valued vectors.

Author:
Elke Achtert

Field Summary
private  double delta
          Holds the value of DELTA_PARAM.
static OptionID DELTA_ID
          OptionID for DELTA_PARAM
private static DoubleParameter DELTA_PARAM
          Parameter to specify the threshold of a distance between a vector q and a given space that indicates that q adds a new dimension to the space, must be a double equal to or greater than 0.
 
Fields inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.correlation.AbstractCorrelationDistanceFunction
SEPARATOR
 
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
PCABasedCorrelationDistanceFunction()
          Provides a PCABasedCorrelationDistanceFunction, adding parameter DELTA_PARAM to the option handler additionally to parameters of super class.
 
Method Summary
private  void adjust(Matrix v, Matrix e_czech, Matrix vector, int corrDim)
          Inserts the specified vector into the given orthonormal matrix v at column corrDim.
 int correlationDistance(PCAFilteredResult pca1, PCAFilteredResult pca2, int dimensionality)
          Computes the correlation distance between the two subspaces defined by the specified PCAs.
(package private)  D correlationDistance(V dv1, V dv2)
          Computes the correlation distance between the two specified vectors.
private  double euclideanDistance(V dv1, V dv2)
          Computes the Euclidean distance between the given two vectors.
 AssociationID<?> getAssociationID()
          Returns the association ID for the association to be set by the preprocessor.
 String getDefaultPreprocessorClassName()
          Returns the name of the default preprocessor.
 String getPreprocessorDescription()
          Returns the description for the preprocessor parameter.
 Class<P> getPreprocessorSuperClass()
          Returns the super class for the preprocessor parameter.
 D infiniteDistance()
          Provides an infinite distance.
 D nullDistance()
          Provides a null distance.
 List<String> setParameters(List<String> args)
          Calls the super method AbstractPreprocessorBasedDistanceFunction#setParameters(args)} and sets additionally the value of the parameter DELTA_PARAM.
 D undefinedDistance()
          Provides an undefined distance.
 D valueOf(String pattern)
          Provides a distance suitable to this DistanceFunction based on the given pattern.
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.correlation.AbstractCorrelationDistanceFunction
distance, shortDescription
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractPreprocessorBasedDistanceFunction
getPreprocessor, setDatabase
 
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.distance.MeasurementFunction
isInfiniteDistance, isNullDistance, isUndefinedDistance, requiredInputPattern
 
Methods inherited from interface de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameterizable
checkGlobalParameterConstraints, collectOptions, getParameters
 

Field Detail

DELTA_ID

public static final OptionID DELTA_ID
OptionID for DELTA_PARAM


DELTA_PARAM

private static DoubleParameter DELTA_PARAM
Parameter to specify the threshold of a distance between a vector q and a given space that indicates that q adds a new dimension to the space, must be a double equal to or greater than 0.

Default value: 0.25

Key: -pcabasedcorrelationdf.delta


delta

private double delta
Holds the value of DELTA_PARAM.

Constructor Detail

PCABasedCorrelationDistanceFunction

public PCABasedCorrelationDistanceFunction()
Provides a PCABasedCorrelationDistanceFunction, adding parameter DELTA_PARAM to the option handler additionally to parameters of super class.

Method Detail

setParameters

public List<String> setParameters(List<String> args)
                           throws ParameterException
Calls the super method AbstractPreprocessorBasedDistanceFunction#setParameters(args)} and sets additionally the value of the parameter DELTA_PARAM.

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

valueOf

public D valueOf(String pattern)
                                         throws IllegalArgumentException
Provides a distance suitable to this DistanceFunction based on the given pattern.

Parameters:
pattern - A pattern defining a distance suitable to this DistanceFunction
Returns:
a distance suitable to this DistanceFunction based on the given pattern
Throws:
IllegalArgumentException - if the given pattern is not compatible with the requirements of this DistanceFunction

infiniteDistance

public D infiniteDistance()
Provides an infinite distance.

Returns:
an infinite distance

nullDistance

public D nullDistance()
Provides a null distance.

Returns:
a null distance

undefinedDistance

public D undefinedDistance()
Provides an undefined distance.

Returns:
an undefined distance

correlationDistance

D correlationDistance(V dv1,
                      V dv2)
Description copied from class: AbstractCorrelationDistanceFunction
Computes the correlation distance between the two specified vectors.

Specified by:
correlationDistance in class AbstractCorrelationDistanceFunction<V extends RealVector<V,?>,P extends HiCOPreprocessor<V>,D extends CorrelationDistance<D>>
Parameters:
dv1 - first RealVector
dv2 - second RealVector
Returns:
the correlation distance between the two specified vectors

correlationDistance

public int correlationDistance(PCAFilteredResult pca1,
                               PCAFilteredResult pca2,
                               int dimensionality)
Computes the correlation distance between the two subspaces defined by the specified PCAs.

Parameters:
pca1 - first PCA
pca2 - second PCA
dimensionality - the dimensionality of the data space
Returns:
the correlation distance between the two subspaces defined by the specified PCAs

adjust

private void adjust(Matrix v,
                    Matrix e_czech,
                    Matrix vector,
                    int corrDim)
Inserts the specified vector into the given orthonormal matrix v at column corrDim. After insertion the matrix v is orthonormalized and column corrDim of matrix e_czech is set to the corrDim-th unit vector..

Parameters:
v - the orthonormal matrix of the eigenvectors
e_czech - the selection matrix of the strong eigenvectors
vector - the vector to be inserted
corrDim - the column at which the vector should be inserted

euclideanDistance

private double euclideanDistance(V dv1,
                                 V dv2)
Computes the Euclidean distance between the given two vectors.

Parameters:
dv1 - first NumberVector
dv2 - second NumberVector
Returns:
the Euclidean distance between the given two vectors

getDefaultPreprocessorClassName

public String getDefaultPreprocessorClassName()
Description copied from interface: PreprocessorClient
Returns the name of the default preprocessor.

Returns:
the name of the default preprocessor, which is KnnQueryBasedHiCOPreprocessor

getPreprocessorDescription

public String getPreprocessorDescription()
Description copied from interface: PreprocessorClient
Returns the description for the preprocessor parameter.

Returns:
the description for the preprocessor parameter

getPreprocessorSuperClass

public Class<P> getPreprocessorSuperClass()
Description copied from interface: PreprocessorClient
Returns the super class for the preprocessor parameter.

Returns:
the super class for the preprocessor parameter, which is HiCOPreprocessor

getAssociationID

public AssociationID<?> getAssociationID()
Description copied from interface: PreprocessorClient
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.LOCAL_PCA

Release 0.2 (2009-07-06_1820)