Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.evaluation.roc
Class ROC

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.evaluation.roc.ROC

public class ROC
extends Object

Compute ROC (Receiver Operating Characteristics) curves. A ROC curve compares the true positive rate (y-axis) and false positive rate (x-axis). It was first used in radio signal detection, but has since found widespread use in information retrieval, in particular for evaluating binary classification problems. ROC curves are particularly useful to evaluate a ranking of objects with respect to a binary classification problem: a random sampling will approximately achieve a ROC value of 0.5, while a perfect separation will achieve 1.0 (all positives first) or 0.0 (all negatives first). In most use cases, a score significantly below 0.5 indicates that the algorithm result has been used the wrong way, and should be used backwards.

Author:
Erich Schubert

Nested Class Summary
static class ROC.DistanceResultAdapter<D extends Distance<D>>
          This adapter can be used for an arbitrary collection of Integers, and uses that id1.compareTo(id2) !
static class ROC.SimpleAdapter
          This adapter can be used for an arbitrary collection of Integers, and uses that id1.compareTo(id2) !
 
Constructor Summary
ROC()
           
 
Method Summary
static double computeAUC(Iterable<Pair<Double,Double>> curve)
          compute the Area Under Curve (difference to y axis) for an arbitrary polygon
static
<D extends Distance<D>>
double
computeROCAUCDistanceResult(int size, Cluster<?> clus, List<DistanceResultPair<D>> nei)
          Compute a ROC curves Area-under-curve for a QueryResult and a Cluster.
static
<D extends Distance<D>>
double
computeROCAUCDistanceResult(int size, Collection<Integer> ids, List<DistanceResultPair<D>> nei)
          Compute a ROC curves Area-under-curve for a QueryResult and a Cluster.
static double computeROCAUCSimple(int size, Collection<Integer> ids, List<Integer> nei)
          Compute a ROC curves Area-under-curve for a QueryResult and a Cluster.
static
<C extends Comparable<? super C>>
List<Pair<Double,Double>>
materializeROC(int size, Collection<Integer> ids, Iterator<Pair<C,Integer>> nei)
          Compute a ROC curve given a set of positive IDs and a sorted list of (comparable, ID)s, where the comparable object is used to decided when two objects are interchangeable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ROC

public ROC()
Method Detail

materializeROC

public static <C extends Comparable<? super C>> List<Pair<Double,Double>> materializeROC(int size,
                                                                                         Collection<Integer> ids,
                                                                                         Iterator<Pair<C,Integer>> nei)
Compute a ROC curve given a set of positive IDs and a sorted list of (comparable, ID)s, where the comparable object is used to decided when two objects are interchangeable.

Parameters:
size - Database size
ids - Collection of positive IDs, should support efficient contains()
nei - List of neighbors along with some comparable object to detect 'same positions'.
Returns:
area under curve

computeAUC

public static double computeAUC(Iterable<Pair<Double,Double>> curve)
compute the Area Under Curve (difference to y axis) for an arbitrary polygon

Parameters:
curve - Iterable list of points (x,y)
Returns:
area und curve

computeROCAUCDistanceResult

public static <D extends Distance<D>> double computeROCAUCDistanceResult(int size,
                                                                         Cluster<?> clus,
                                                                         List<DistanceResultPair<D>> nei)
Compute a ROC curves Area-under-curve for a QueryResult and a Cluster.

Parameters:
size - Database size
clus - Cluster object
nei - Query result
Returns:
area under curve

computeROCAUCDistanceResult

public static <D extends Distance<D>> double computeROCAUCDistanceResult(int size,
                                                                         Collection<Integer> ids,
                                                                         List<DistanceResultPair<D>> nei)
Compute a ROC curves Area-under-curve for a QueryResult and a Cluster.

Parameters:
size - Database size
ids - Collection of positive IDs, should support efficient contains()
nei - Query Result
Returns:
area under curve

computeROCAUCSimple

public static double computeROCAUCSimple(int size,
                                         Collection<Integer> ids,
                                         List<Integer> nei)
Compute a ROC curves Area-under-curve for a QueryResult and a Cluster.

Parameters:
size - Database size
ids - Collection of positive IDs, should support efficient contains()
nei - Query Result
Returns:
area under curve

Release 0.2.1 (2009-07-13_1605)