Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.algorithm
Class DistanceBasedAlgorithm<O extends DatabaseObject,D extends Distance<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.algorithm.AbstractAlgorithm<O>
              extended by de.lmu.ifi.dbs.elki.algorithm.DistanceBasedAlgorithm<O,D>
Type Parameters:
O - the type of DatabaseObjects handled by this Algorithm
D - the type of Distance used by this Algorithm
All Implemented Interfaces:
Algorithm<O>, Loggable, Parameterizable
Direct Known Subclasses:
DBSCAN, DeLiClu, DependencyDerivator, KMeans, KNNDistanceOrder, KNNJoin, OPTICS, SLINK

public abstract class DistanceBasedAlgorithm<O extends DatabaseObject,D extends Distance<D>>
extends AbstractAlgorithm<O>

Provides an abstract algorithm already setting the distance function.

Author:
Arthur Zimek

Field Summary
static OptionID DISTANCE_FUNCTION_ID
          OptionID for DISTANCE_FUNCTION_PARAM
protected  ClassParameter<DistanceFunction> DISTANCE_FUNCTION_PARAM
          Parameter to specify the distance function to determine the distance between database objects, must extend DistanceFunction.
private  DistanceFunction<O,D> distanceFunction
          Holds the instance of the distance function specified by DISTANCE_FUNCTION_PARAM.
 
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
protected DistanceBasedAlgorithm()
          Adds parameter DISTANCE_FUNCTION_PARAM, to the option handler additionally to parameters of super class.
 
Method Summary
 List<AttributeSettings> getAttributeSettings()
          Calls AbstractParameterizable.getAttributeSettings() and adds to the returned attribute settings the attribute settings of the distanceFunction.
 DistanceFunction<O,D> getDistanceFunction()
          Returns the distanceFunction.
 String[] setParameters(String[] args)
          Calls AbstractAlgorithm#setParameters(args) and instantiates distanceFunction according to the value of parameter DISTANCE_FUNCTION_PARAM.
 
Methods inherited from class de.lmu.ifi.dbs.elki.algorithm.AbstractAlgorithm
description, isTime, isVerbose, run, runInTime, setTime, setVerbose
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
addOption, checkGlobalParameterConstraints, deleteOption, description, description, getParameters, getParameterValue, getPossibleOptions, inlineDescription, isSet, 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.algorithm.Algorithm
getDescription, getResult
 
Methods inherited from interface de.lmu.ifi.dbs.elki.utilities.optionhandling.Parameterizable
checkGlobalParameterConstraints, getParameters, getPossibleOptions, inlineDescription
 

Field Detail

DISTANCE_FUNCTION_ID

public static final OptionID DISTANCE_FUNCTION_ID
OptionID for DISTANCE_FUNCTION_PARAM


DISTANCE_FUNCTION_PARAM

protected final ClassParameter<DistanceFunction> DISTANCE_FUNCTION_PARAM
Parameter to specify the distance function to determine the distance between database objects, must extend DistanceFunction.

Key: -algorithm.distancefunction

Default value: EuklideanDistanceFunction


distanceFunction

private DistanceFunction<O extends DatabaseObject,D extends Distance<D>> distanceFunction
Holds the instance of the distance function specified by DISTANCE_FUNCTION_PARAM.

Constructor Detail

DistanceBasedAlgorithm

protected DistanceBasedAlgorithm()
Adds parameter DISTANCE_FUNCTION_PARAM, to the option handler additionally to parameters of super class.

Method Detail

setParameters

public String[] setParameters(String[] args)
                       throws ParameterException
Calls AbstractAlgorithm#setParameters(args) and instantiates distanceFunction according to the value of parameter DISTANCE_FUNCTION_PARAM. The remaining parameters are passed to the distanceFunction.

Specified by:
setParameters in interface Parameterizable
Overrides:
setParameters in class AbstractAlgorithm<O extends DatabaseObject>
Parameters:
args - parameters to set the attributes accordingly to
Returns:
String[] an array containing the unused parameters
Throws:
ParameterException - in case of wrong parameter-setting
See Also:
Parameterizable.setParameters(String[])

getAttributeSettings

public List<AttributeSettings> getAttributeSettings()
Calls AbstractParameterizable.getAttributeSettings() and adds to the returned attribute settings the attribute settings of the distanceFunction.

Specified by:
getAttributeSettings in interface Parameterizable
Overrides:
getAttributeSettings in class AbstractParameterizable
Returns:
the setting of the attributes of the parameterizable
See Also:
Parameterizable.getAttributeSettings()

getDistanceFunction

public DistanceFunction<O,D> getDistanceFunction()
Returns the distanceFunction.

Returns:
the distanceFunction

Release 0.1 (2008-07-10_1838)