Class ROCEvaluation

  • All Implemented Interfaces:
    ScoreEvaluation

    public class ROCEvaluation
    extends java.lang.Object
    implements ScoreEvaluation
    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.

    Since:
    0.7.0
    Author:
    Erich Schubert
    • Field Detail

      • STATIC

        public static final ROCEvaluation STATIC
        Static instance
    • Constructor Detail

      • ROCEvaluation

        public ROCEvaluation()
    • Method Detail

      • materializeROC

        public static ROCEvaluation.ROCurve materializeROC​(ScoreEvaluation.Adapter adapter)
        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:
        adapter - Adapter for different input data types
        Returns:
        area under curve
      • computeAUROC

        public static double computeAUROC​(ScoreEvaluation.Adapter adapter)
        Compute the area under the 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:
        adapter - Adapter for different input data types
        Returns:
        area under curve
      • expected

        public double expected​(int pos,
                               int all)
        Description copied from interface: ScoreEvaluation
        Expected score for a random result.
        Specified by:
        expected in interface ScoreEvaluation
        Parameters:
        pos - Number of positive elements
        all - Total number of elements
        Returns:
        Expected score