Class CostCurve

  • All Implemented Interfaces:
    RevisionHandler

    public class CostCurve
    extends java.lang.Object
    implements RevisionHandler
    Generates points illustrating probablity cost tradeoffs that can be obtained by varying the threshold value between classes. For example, the typical threshold value of 0.5 means the predicted probability of "positive" must be higher than 0.5 for the instance to be predicted as "positive".
    Version:
    $Revision: 1.9 $
    Author:
    Mark Hall (mhall@cs.waikato.ac.nz)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String NORM_EXPECTED_COST_NAME
      attribute name: Normalized Expected Cost
      static java.lang.String PROB_COST_FUNC_NAME
      attribute name: Probability Cost Function
      static java.lang.String RELATION_NAME
      The name of the relation used in cost curve datasets
      static java.lang.String THRESHOLD_NAME
      attribute name: Threshold
    • Constructor Summary

      Constructors 
      Constructor Description
      CostCurve()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Instances getCurve​(FastVector predictions)
      Calculates the performance stats for the default class and return results as a set of Instances.
      Instances getCurve​(FastVector predictions, int classIndex)
      Calculates the performance stats for the desired class and return results as a set of Instances.
      java.lang.String getRevision()
      Returns the revision string.
      static void main​(java.lang.String[] args)
      Tests the CostCurve generation from the command line.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • RELATION_NAME

        public static final java.lang.String RELATION_NAME
        The name of the relation used in cost curve datasets
        See Also:
        Constant Field Values
      • PROB_COST_FUNC_NAME

        public static final java.lang.String PROB_COST_FUNC_NAME
        attribute name: Probability Cost Function
        See Also:
        Constant Field Values
      • NORM_EXPECTED_COST_NAME

        public static final java.lang.String NORM_EXPECTED_COST_NAME
        attribute name: Normalized Expected Cost
        See Also:
        Constant Field Values
      • THRESHOLD_NAME

        public static final java.lang.String THRESHOLD_NAME
        attribute name: Threshold
        See Also:
        Constant Field Values
    • Constructor Detail

      • CostCurve

        public CostCurve()
    • Method Detail

      • getCurve

        public Instances getCurve​(FastVector predictions)
        Calculates the performance stats for the default class and return results as a set of Instances. The structure of these Instances is as follows:

        • Probability Cost Function
        • Normalized Expected Cost
        • Threshold contains the probability threshold that gives rise to the previous performance values.

        Parameters:
        predictions - the predictions to base the curve on
        Returns:
        datapoints as a set of instances, null if no predictions have been made.
        See Also:
        TwoClassStats
      • getCurve

        public Instances getCurve​(FastVector predictions,
                                  int classIndex)
        Calculates the performance stats for the desired class and return results as a set of Instances.
        Parameters:
        predictions - the predictions to base the curve on
        classIndex - index of the class of interest.
        Returns:
        datapoints as a set of instances.
      • getRevision

        public java.lang.String getRevision()
        Returns the revision string.
        Specified by:
        getRevision in interface RevisionHandler
        Returns:
        the revision
      • main

        public static void main​(java.lang.String[] args)
        Tests the CostCurve generation from the command line. The classifier is currently hardcoded. Pipe in an arff file.
        Parameters:
        args - currently ignored