Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.distance.similarityfunction.kernel
Class ArbitraryKernelFunctionWrapper<O extends RealVector<O,?>>

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.similarityfunction.kernel.AbstractKernelFunction<O,DoubleDistance>
                      extended by de.lmu.ifi.dbs.elki.distance.similarityfunction.kernel.AbstractDoubleKernelFunction<O>
                          extended by de.lmu.ifi.dbs.elki.distance.similarityfunction.kernel.ArbitraryKernelFunctionWrapper<O>
All Implemented Interfaces:
DistanceFunction<O,DoubleDistance>, MeasurementFunction<O,DoubleDistance>, KernelFunction<O,DoubleDistance>, SimilarityFunction<O,DoubleDistance>, Loggable, Parameterizable

public class ArbitraryKernelFunctionWrapper<O extends RealVector<O,?>>
extends AbstractDoubleKernelFunction<O>

Provides a wrapper for arbitrary kernel functions whose kernel matrix has been precomputed.

Author:
Simon Paradies

Field Summary
private  KernelMatrix<O> kernelMatrix
          The global 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
 
Constructor Summary
ArbitraryKernelFunctionWrapper()
          Provides a wrapper for arbitrary kernel functions whose kernel matrix has already been precomputed.
 
Method Summary
 String description()
          Returns a description of the class and the required parameters.
 DoubleDistance distance(Integer id1, Integer id2)
          Returns the distance between the two objects specified by their object ids.
 DoubleDistance distance(O o1, O o2)
          Returns the distance between the two specified objects.
 void setDatabase(Database<O> database, boolean verbose, boolean time)
          Set the database that holds the associations for the DatabaseObject for which the measurements should be computed.
 DoubleDistance similarity(O o1, O o2)
          Provides a wrapper for arbitrary kernel functions whose kernel matrix has already been precomputed.
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.similarityfunction.kernel.AbstractDoubleKernelFunction
infiniteDistance, nullDistance, undefinedDistance, valueOf
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.similarityfunction.kernel.AbstractKernelFunction
similarity, similarity
 
Methods inherited from class de.lmu.ifi.dbs.elki.distance.distancefunction.AbstractDistanceFunction
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, checkGlobalParameterConstraints, deleteOption, description, description, getAttributeSettings, getParameters, getParameterValue, getPossibleOptions, inlineDescription, isSet, setParameters, setParameters
 
Methods inherited from class de.lmu.ifi.dbs.elki.logging.AbstractLoggable
debugFine, debugFiner, debugFinest, exception, message, progress, progress, progress, verbose, 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
 
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, getAttributeSettings, getParameters, getPossibleOptions, inlineDescription, setParameters
 

Field Detail

kernelMatrix

private KernelMatrix<O extends RealVector<O,?>> kernelMatrix
The global kernel Matrix.

Constructor Detail

ArbitraryKernelFunctionWrapper

public ArbitraryKernelFunctionWrapper()
Provides a wrapper for arbitrary kernel functions whose kernel matrix has already been precomputed.

Method Detail

similarity

public DoubleDistance similarity(O o1,
                                 O o2)
Provides a wrapper for arbitrary kernel functions whose kernel matrix has already been precomputed. Returns the value that is stored in the kernel matrix which itself is stored in the database.

Parameters:
o1 - first vector
o2 - second vector
Returns:
the linear kernel similarity which is stored in the Global Database
See Also:
DistanceFunction.distance(de.lmu.ifi.dbs.elki.data.DatabaseObject, de.lmu.ifi.dbs.elki.data.DatabaseObject)

distance

public DoubleDistance distance(O o1,
                               O o2)
Returns the distance between the two specified objects.

Specified by:
distance in interface DistanceFunction<O extends RealVector<O,?>,DoubleDistance>
Overrides:
distance in class AbstractDoubleKernelFunction<O extends RealVector<O,?>>
Parameters:
o1 - first DatabaseObject
o2 - second DatabaseObject
Returns:
the distance between the two objcts specified by their obejct ids
See Also:
DistanceFunction.distance(DatabaseObject, DatabaseObject)

distance

public DoubleDistance distance(Integer id1,
                               Integer id2)
Returns the distance between the two objects specified by their object ids.

Specified by:
distance in interface DistanceFunction<O extends RealVector<O,?>,DoubleDistance>
Overrides:
distance in class AbstractDistanceFunction<O extends RealVector<O,?>,DoubleDistance>
Parameters:
id1 - first object id
id2 - second object id
Returns:
the distance between the two objects specified by their object ids

description

public String description()
Description copied from interface: Parameterizable
Returns a description of the class and the required parameters.

This description should be suitable for a usage description as for a standalone application.

Specified by:
description in interface Parameterizable
Overrides:
description in class AbstractParameterizable
Returns:
String a description of the class and the required parameters
See Also:
Parameterizable.description()

setDatabase

public void setDatabase(Database<O> 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<O extends RealVector<O,?>,DoubleDistance>
Overrides:
setDatabase in class AbstractMeasurementFunction<O extends RealVector<O,?>,DoubleDistance>
Parameters:
database - the database to be set
verbose - flag to allow verbose messages while performing the method
time - flag to request output of performance time
See Also:
MeasurementFunction.setDatabase(de.lmu.ifi.dbs.elki.database.Database, boolean, boolean)

Release 0.1 (2008-07-10_1838)