de.lmu.ifi.dbs.elki.algorithm.statistics
Class EvaluateRankingQuality<V extends NumberVector<V,?>,D extends NumberDistance<D,?>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.algorithm.AbstractAlgorithm<R>
      extended by de.lmu.ifi.dbs.elki.algorithm.AbstractDistanceBasedAlgorithm<V,D,CollectionResult<DoubleVector>>
          extended by de.lmu.ifi.dbs.elki.algorithm.statistics.EvaluateRankingQuality<V,D>
Type Parameters:
V - Vector type
D - Distance type
All Implemented Interfaces:
Algorithm, InspectionUtilFrequentlyScanned, Parameterizable

@Title(value="Evaluate Ranking Quality")
@Description(value="Evaluates the effectiveness of a distance function via the obtained rankings.")
public class EvaluateRankingQuality<V extends NumberVector<V,?>,D extends NumberDistance<D,?>>
extends AbstractDistanceBasedAlgorithm<V,D,CollectionResult<DoubleVector>>

Evaluate a distance function with respect to kNN queries. For each point, the neighbors are sorted by distance, then the ROC AUC is computed. A score of 1 means that the distance function provides a perfect ordering of relevant neighbors first, then irrelevant neighbors. A value of 0.5 can be obtained by random sorting. A value of 0 means the distance function is inverted, i.e. a similarity. In contrast to RankingQualityHistogram, this method uses a binning based on the centrality of objects. This allows analyzing whether or not a particular distance degrades for the outer parts of a cluster. TODO: Allow fixed binning range, configurable TODO: Add sampling


Nested Class Summary
static class EvaluateRankingQuality.Parameterizer<V extends NumberVector<V,?>,D extends NumberDistance<D,?>>
          Parameterization class.
 
Field Summary
static OptionID HISTOGRAM_BINS_ID
          Option to configure the number of bins to use.
private static Logging logger
          The logger for this class.
(package private)  int numbins
          Number of bins to use.
 
Fields inherited from class de.lmu.ifi.dbs.elki.algorithm.AbstractDistanceBasedAlgorithm
DISTANCE_FUNCTION_ID
 
Constructor Summary
EvaluateRankingQuality(DistanceFunction<? super V,D> distanceFunction, int numbins)
          Constructor.
 
Method Summary
 TypeInformation[] getInputTypeRestriction()
          Get the input type restriction used for negotiating the data query.
protected  Logging getLogger()
          Get the (STATIC) logger for this class.
 HistogramResult<DoubleVector> run(Database database)
          Run the algorithm.
 
Methods inherited from class de.lmu.ifi.dbs.elki.algorithm.AbstractDistanceBasedAlgorithm
getDistanceFunction
 
Methods inherited from class de.lmu.ifi.dbs.elki.algorithm.AbstractAlgorithm
makeParameterDistanceFunction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final Logging logger
The logger for this class.


HISTOGRAM_BINS_ID

public static final OptionID HISTOGRAM_BINS_ID
Option to configure the number of bins to use.


numbins

int numbins
Number of bins to use.

Constructor Detail

EvaluateRankingQuality

public EvaluateRankingQuality(DistanceFunction<? super V,D> distanceFunction,
                              int numbins)
Constructor.

Parameters:
distanceFunction -
numbins -
Method Detail

run

public HistogramResult<DoubleVector> run(Database database)
                                  throws IllegalStateException
Run the algorithm.

Specified by:
run in interface Algorithm
Overrides:
run in class AbstractAlgorithm<CollectionResult<DoubleVector>>
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).

getInputTypeRestriction

public TypeInformation[] getInputTypeRestriction()
Description copied from class: AbstractAlgorithm
Get the input type restriction used for negotiating the data query.

Specified by:
getInputTypeRestriction in interface Algorithm
Specified by:
getInputTypeRestriction in class AbstractAlgorithm<CollectionResult<DoubleVector>>
Returns:
Type restriction

getLogger

protected Logging getLogger()
Description copied from class: AbstractAlgorithm
Get the (STATIC) logger for this class.

Specified by:
getLogger in class AbstractAlgorithm<CollectionResult<DoubleVector>>
Returns:
the static logger

Release 0.4.0 (2011-09-20_1324)