All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Class weka.classifiers.evaluation.ThresholdCurve

java.lang.Object
    |
    +----weka.classifiers.evaluation.ThresholdCurve

public class ThresholdCurve
extends java.lang.Object
Generates points illustrating prediction 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". The resulting dataset can be used to visualize precision/recall tradeoff, or for ROC curve analysis (true positive rate vs false positive rate).

Version:
$Revision: 1.12 $
Author:
Len Trigg (len@intelligenesis.net)

Variable Index

 o FALLOUT_NAME
 
 o FALSE_NEG_NAME
 
 o FALSE_POS_NAME
 
 o FMEASURE_NAME
 
 o FP_RATE_NAME
 
 o PRECISION_NAME
 
 o RECALL_NAME
 
 o RELATION_NAME
The name of the relation used in threshold curve datasets
 o THRESHOLD_NAME
 
 o TP_RATE_NAME
 
 o TRUE_NEG_NAME
 
 o TRUE_POS_NAME
 

Constructor Index

 o ThresholdCurve()
 

Method Index

 o getCurve(FastVector)
Calculates the performance stats for the default class and return results as a set of Instances.
 o getCurve(FastVector, int)
Calculates the performance stats for the desired class and return results as a set of Instances.
 o getNPointPrecision(Instances, int)
Calculates the n point precision result, which is the precision averaged over n evenly spaced (w.r.t recall) samples of the curve.
 o getROCArea(Instances)
Calculates the area under the ROC curve.
 o getThresholdInstance(Instances, double)
Gets the index of the instance with the closest threshold value to the desired target
 o main(String[])
Tests the ThresholdCurve generation from the command line.

Field Detail

 o RELATION_NAME
public static final java.lang.String RELATION_NAME
          The name of the relation used in threshold curve datasets
 o TRUE_POS_NAME
public static final java.lang.String TRUE_POS_NAME
 o FALSE_NEG_NAME
public static final java.lang.String FALSE_NEG_NAME
 o FALSE_POS_NAME
public static final java.lang.String FALSE_POS_NAME
 o TRUE_NEG_NAME
public static final java.lang.String TRUE_NEG_NAME
 o FP_RATE_NAME
public static final java.lang.String FP_RATE_NAME
 o TP_RATE_NAME
public static final java.lang.String TP_RATE_NAME
 o PRECISION_NAME
public static final java.lang.String PRECISION_NAME
 o RECALL_NAME
public static final java.lang.String RECALL_NAME
 o FALLOUT_NAME
public static final java.lang.String FALLOUT_NAME
 o FMEASURE_NAME
public static final java.lang.String FMEASURE_NAME
 o THRESHOLD_NAME
public static final java.lang.String THRESHOLD_NAME

Constructor Detail

 o ThresholdCurve
public ThresholdCurve()

Method Detail

 o 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:

For the definitions of these measures, see TwoClassStats

Parameters:
classIndex - index of the class of interest.
Returns:
datapoints as a set of instances, null if no predictions have been made.
See Also:
TwoClassStats
 o 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:
classIndex - index of the class of interest.
Returns:
datapoints as a set of instances.
 o getNPointPrecision
public static double getNPointPrecision(Instances tcurve,
                                        int n)
          Calculates the n point precision result, which is the precision averaged over n evenly spaced (w.r.t recall) samples of the curve.
Parameters:
tcurve - a previously extracted threshold curve Instances.
n - the number of points to average over.
Returns:
the n-point precision.
 o getROCArea
public static double getROCArea(Instances tcurve)
          Calculates the area under the ROC curve. This is normalised so that 0.5 is random, 1.0 is perfect and 0.0 is bizarre.
Parameters:
tcurve - a previously extracted threshold curve Instances.
Returns:
the ROC area, or Double.NaN if you don't pass in a ThresholdCurve generated Instances.
 o getThresholdInstance
public static int getThresholdInstance(Instances tcurve,
                                       double threshold)
          Gets the index of the instance with the closest threshold value to the desired target
Parameters:
tcurve - a set of instances that have been generated by this class
threshold - the target threshold
Returns:
the index of the instance that has threshold closest to the target, or -1 if this could not be found (i.e. no data, or bad threshold target)
 o main
public static void main(java.lang.String args[])
          Tests the ThresholdCurve generation from the command line. The classifier is currently hardcoded. Pipe in an arff file.
Parameters:
args - currently ignored

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home