weka.classifiers.evaluation
Class MarginCurve

java.lang.Object
  extended byweka.classifiers.evaluation.MarginCurve

public class MarginCurve
extends java.lang.Object

Generates points illustrating the prediction margin. The margin is defined as the difference between the probability predicted for the actual class and the highest probability predicted for the other classes. One hypothesis as to the good performance of boosting algorithms is that they increaes the margins on the training data and this gives better performance on test data.

Version:
$Revision: 1.9 $
Author:
Len Trigg (len@reeltwo.com)

Constructor Summary
MarginCurve()
           
 
Method Summary
 Instances getCurve(FastVector predictions)
          Calculates the cumulative margin distribution for the set of predictions, returning the result as a set of Instances.
private  double[] getMargins(FastVector predictions)
          Pulls all the margin values out of a vector of NominalPredictions.
static void main(java.lang.String[] args)
          Tests the MarginCurve generation from the command line.
private  Instances makeHeader()
          Creates an Instances object with the attributes we will be calculating.
private  Instance makeInstance(double margin, int current, int cumulative)
          Creates an Instance object with the attributes calculated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MarginCurve

public MarginCurve()
Method Detail

getCurve

public Instances getCurve(FastVector predictions)
Calculates the cumulative margin distribution for the set of predictions, returning the result as a set of Instances. The structure of these Instances is as follows:

Returns:
datapoints as a set of instances, null if no predictions have been made.

getMargins

private double[] getMargins(FastVector predictions)
Pulls all the margin values out of a vector of NominalPredictions.

Parameters:
predictions - a FastVector containing NominalPredictions
Returns:
an array of margin values.

makeHeader

private Instances makeHeader()
Creates an Instances object with the attributes we will be calculating.

Returns:
the Instances structure.

makeInstance

private Instance makeInstance(double margin,
                              int current,
                              int cumulative)
Creates an Instance object with the attributes calculated.

Parameters:
margin - the margin for this data point.
current - the number of instances with this margin.
cumulative - the number of instances with margin less than or equal to this margin.
Returns:
the Instance object.

main

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

Parameters:
args - currently ignored