Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.algorithm
Class KNNDistanceOrder<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,R>
              extended by de.lmu.ifi.dbs.elki.algorithm.DistanceBasedAlgorithm<O,D,KNNDistanceOrderResult<D>>
                  extended by de.lmu.ifi.dbs.elki.algorithm.KNNDistanceOrder<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,KNNDistanceOrderResult<D>>, Parameterizable

public class KNNDistanceOrder<O extends DatabaseObject,D extends Distance<D>>
extends DistanceBasedAlgorithm<O,D,KNNDistanceOrderResult<D>>

Provides an order of the kNN-distances for all objects within the database.

Author:
Arthur Zimek

Field Summary
private  int k
          Holds the value of K_PARAM.
static OptionID K_ID
          OptionID for K_PARAM
private  IntParameter K_PARAM
          Parameter to specify the distance of the k-distant object to be assessed, must be an integer greater than 0.
private  double percentage
          Holds the value of PERCENTAGE_PARAM.
static OptionID PERCENTAGE_ID
          OptionID for PERCENTAGE_PARAM
 DoubleParameter PERCENTAGE_PARAM
          Parameter to specify the average percentage of distances randomly choosen to be provided in the result, must be a double greater than 0 and less than or equal to 1.
private  KNNDistanceOrderResult<D> result
          Holds the result.
 
Fields inherited from class de.lmu.ifi.dbs.elki.algorithm.DistanceBasedAlgorithm
DISTANCE_FUNCTION_ID, 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, logger
 
Constructor Summary
KNNDistanceOrder()
          Provides an algorithm to order the kNN-distances for all objects of the database, adding parameters K_PARAM and PERCENTAGE_PARAM to the option handler additionally to parameters of super class.
 
Method Summary
 Description getDescription()
          Returns a description of the algorithm.
 KNNDistanceOrderResult<D> getResult()
          Returns the result of the algorithm.
protected  KNNDistanceOrderResult<D> runInTime(Database<O> database)
          Provides an order of the kNN-distances for all objects within the specified database.
 List<String> setParameters(List<String> args)
          Calls the super method and sets additionally the values of the parameters K_PARAM and PERCENTAGE_PARAM.
 
Methods inherited from class de.lmu.ifi.dbs.elki.algorithm.DistanceBasedAlgorithm
getDistanceFunction
 
Methods inherited from class de.lmu.ifi.dbs.elki.algorithm.AbstractAlgorithm
isTime, isVerbose, run, setTime, setVerbose
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.optionhandling.AbstractParameterizable
addOption, addParameterizable, addParameterizable, checkGlobalParameterConstraints, collectOptions, getAttributeSettings, getParameters, rememberParametersExcept, removeOption, removeParameterizable, shortDescription
 
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, shortDescription
 

Field Detail

K_ID

public static final OptionID K_ID
OptionID for K_PARAM


K_PARAM

private final IntParameter K_PARAM
Parameter to specify the distance of the k-distant object to be assessed, must be an integer greater than 0.

Default value: 1

Key: -knndistanceorder.k


k

private int k
Holds the value of K_PARAM.


PERCENTAGE_ID

public static final OptionID PERCENTAGE_ID
OptionID for PERCENTAGE_PARAM


PERCENTAGE_PARAM

public final DoubleParameter PERCENTAGE_PARAM
Parameter to specify the average percentage of distances randomly choosen to be provided in the result, must be a double greater than 0 and less than or equal to 1.

Default value: 1.0

Key: -knndistanceorder.percentage


percentage

private double percentage
Holds the value of PERCENTAGE_PARAM.


result

private KNNDistanceOrderResult<D extends Distance<D>> result
Holds the result.

Constructor Detail

KNNDistanceOrder

public KNNDistanceOrder()
Provides an algorithm to order the kNN-distances for all objects of the database, adding parameters K_PARAM and PERCENTAGE_PARAM to the option handler additionally to parameters of super class.

Method Detail

runInTime

protected KNNDistanceOrderResult<D> runInTime(Database<O> database)
                                                           throws IllegalStateException
Provides an order of the kNN-distances for all objects within the specified database.

Specified by:
runInTime in class AbstractAlgorithm<O extends DatabaseObject,KNNDistanceOrderResult<D extends Distance<D>>>
Parameters:
database - the database to run the algorithm on
Returns:
the Result computed by this algorithm
Throws:
IllegalStateException - if the algorithm has not been initialized properly (e.g. the setParameters(String[]) method has been failed to be called).

getResult

public KNNDistanceOrderResult<D> getResult()
Description copied from interface: Algorithm
Returns the result of the algorithm.

Returns:
the result of the algorithm

setParameters

public List<String> setParameters(List<String> args)
                           throws ParameterException
Calls the super method and sets additionally the values of the parameters K_PARAM and PERCENTAGE_PARAM.

Specified by:
setParameters in interface Parameterizable
Overrides:
setParameters in class DistanceBasedAlgorithm<O extends DatabaseObject,D extends Distance<D>,KNNDistanceOrderResult<D extends Distance<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

getDescription

public Description getDescription()
Description copied from interface: Algorithm
Returns a description of the algorithm.

Returns:
a description of the algorithm

Release 0.2.1 (2009-07-13_1605)