Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.evaluation
Class ComputeROCCurve<O extends DatabaseObject>

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,MultiResult>
              extended by de.lmu.ifi.dbs.elki.evaluation.ComputeROCCurve<O>
Type Parameters:
O - Database object type
All Implemented Interfaces:
Algorithm<O,MultiResult>, Parameterizable

public class ComputeROCCurve<O extends DatabaseObject>
extends AbstractAlgorithm<O,MultiResult>

Compute a ROC curve to evaluate a ranking algorithm and compute the corresponding ROCAUC value. The parameter -rocauc.positive specifies the class label of "positive" hits. The nested algorithm -algorithm will be run, the result will be searched for an iterable or ordering result, which then is compared with the clustering obtained via the given class label.

Author:
Erich Schubert

Field Summary
private  Algorithm<O,Result> algorithm
          Holds the algorithm to run.
private  ClassParameter<Algorithm<O,Result>> ALGORITHM_PARAM
          Parameter to specify the algorithm to be applied, must extend Algorithm.
private  String positive_class_name
          Stores the "positive" class.
static OptionID POSITIVE_CLASS_NAME_ID
          OptionID for POSITIVE_CLASS_NAME_PARAM
private  PatternParameter POSITIVE_CLASS_NAME_PARAM
          The distance function to determine the reachability distance between database objects.
private  MultiResult result
          Stores the result object.
static AssociationID<Double> ROC_AUC
          The association id to associate the ROC Area-under-Curve.
 
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
ComputeROCCurve()
           
 
Method Summary
 Description getDescription()
          Returns a description of the algorithm.
private  Iterator<Integer> getIterableResult(Database<O> database, Result result)
          Find an "iterable" result that looks like object IDs.
private  Cluster<Model> getReferenceCluster(Database<O> database, String class_name)
          Find the "positive" reference cluster using a by label clustering.
 MultiResult getResult()
          Returns the result of the algorithm.
protected  MultiResult runInTime(Database<O> database)
          The run method encapsulated in measure of runtime.
 List<String> setParameters(List<String> args)
          Calls the super method and sets additionally the values of the flags AbstractAlgorithm.VERBOSE_FLAG and AbstractAlgorithm.TIME_FLAG.
 
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

POSITIVE_CLASS_NAME_ID

public static final OptionID POSITIVE_CLASS_NAME_ID
OptionID for POSITIVE_CLASS_NAME_PARAM


POSITIVE_CLASS_NAME_PARAM

private final PatternParameter POSITIVE_CLASS_NAME_PARAM
The distance function to determine the reachability distance between database objects.

Default value: EuclideanDistanceFunction

Key: -rocauc.positive


ALGORITHM_PARAM

private final ClassParameter<Algorithm<O extends DatabaseObject,Result>> ALGORITHM_PARAM
Parameter to specify the algorithm to be applied, must extend Algorithm.

Key: -algorithm


positive_class_name

private String positive_class_name
Stores the "positive" class.


algorithm

private Algorithm<O extends DatabaseObject,Result> algorithm
Holds the algorithm to run.


ROC_AUC

public static final AssociationID<Double> ROC_AUC
The association id to associate the ROC Area-under-Curve.


result

private MultiResult result
Stores the result object.

Constructor Detail

ComputeROCCurve

public ComputeROCCurve()
Method Detail

runInTime

protected MultiResult runInTime(Database<O> database)
                         throws IllegalStateException
Description copied from class: AbstractAlgorithm
The run method encapsulated in measure of runtime. An extending class needs not to take care of runtime itself.

Specified by:
runInTime in class AbstractAlgorithm<O extends DatabaseObject,MultiResult>
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).

getReferenceCluster

private Cluster<Model> getReferenceCluster(Database<O> database,
                                           String class_name)
Find the "positive" reference cluster using a by label clustering.

Parameters:
database - Database to search in
class_name - Cluster name
Returns:
found cluster or it throws an exception.

getIterableResult

private Iterator<Integer> getIterableResult(Database<O> database,
                                            Result result)
Find an "iterable" result that looks like object IDs.

Parameters:
database - Database context
result - Result object
Returns:
Iterator to work with

getDescription

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

Returns:
a description of the algorithm

getResult

public MultiResult 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
Description copied from class: AbstractAlgorithm
Calls the super method and sets additionally the values of the flags AbstractAlgorithm.VERBOSE_FLAG and AbstractAlgorithm.TIME_FLAG.

Specified by:
setParameters in interface Parameterizable
Overrides:
setParameters in class AbstractAlgorithm<O extends DatabaseObject,MultiResult>
Parameters:
args - parameters to set the attributes accordingly to
Returns:
a list containing the unused parameters
Throws:
ParameterException - in case of wrong parameter-setting

Release 0.2 (2009-07-06_1820)