com.rapidminer.operator.performance
Class BinaryClassificationPerformance

java.lang.Object
  extended by com.rapidminer.operator.AbstractIOObject
      extended by com.rapidminer.operator.ResultObjectAdapter
          extended by com.rapidminer.tools.math.Averagable
              extended by com.rapidminer.operator.performance.PerformanceCriterion
                  extended by com.rapidminer.operator.performance.MeasuredPerformance
                      extended by com.rapidminer.operator.performance.BinaryClassificationPerformance
All Implemented Interfaces:
IOObject, ResultObject, Saveable, Readable, Reportable, Tableable, LoggingHandler, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<PerformanceCriterion>

public class BinaryClassificationPerformance
extends MeasuredPerformance
implements Tableable

This class encapsulates the well known binary classification criteria precision and recall. Furthermore it can be used to calculate the fallout, the equally weighted f-measure (f1-measure), the lift, and the values for TRUE_POSITIVE, FALSE_POSITIVE, TRUE_NEGATIVE, and FALSE_NEGATIVE. With "positive" we refer to the first class and with "negative" we refer to the second.

Author:
Ingo Mierswa, Simon Fischer ingomierswa Exp $
See Also:
Serialized Form

Field Summary
static java.lang.String[] DESCRIPTIONS
           
static int F_MEASURE
           
static int FALLOUT
           
static int FALSE_NEGATIVE
           
static int FALSE_POSITIVE
           
static int LIFT
           
static java.lang.String[] NAMES
           
static int NEGATIVE_PREDICTIVE_VALUE
           
static int POSITIVE_PREDICTIVE_VALUE
           
static int PRECISION
           
static int PSEP
           
static int RECALL
           
static int SENSITIVITY
           
static int SPECIFICITY
           
static int TRUE_NEGATIVE
           
static int TRUE_POSITIVE
           
static int YOUDEN
           
 
Constructor Summary
BinaryClassificationPerformance()
           
BinaryClassificationPerformance(BinaryClassificationPerformance o)
           
BinaryClassificationPerformance(int type)
           
BinaryClassificationPerformance(int type, double[][] counter)
          For test cases only.
 
Method Summary
 void buildSingleAverage(Averagable performance)
          This method should build the average of this and another averagable of the same type.
 void countExample(Example example)
          Counts a single example, e.g. by summing up errors.
 void finishReporting()
           
 boolean formatPercent()
          Indicates wether or not percentage format should be used in the Averagable.toString() method.
 java.lang.String getCell(int row, int column)
           
 java.lang.String getColumnName(int columnIndex)
           
 int getColumnNumber()
           
 java.lang.String getDescription()
          Returns a description of the performance criterion.
 double getExampleCount()
          Returns the number of data points which was used to determine the criterion value.
 double getFitness()
          Returns the fitness depending on the value.
 double getMaxFitness()
          Returns the maximum fitness.
 double getMikroAverage()
          Returns the (current) value of the averagable (the average itself).
 double getMikroVariance()
          Returns the variance of the averagable.
 java.lang.String getName()
          Returns the name of this averagable.
 int getRowNumber()
           
 java.awt.Component getVisualizationComponent(IOContainer ioContainer)
          This implementation returns a confusion matrix viewer based on a JTable.
 boolean isFirstColumnHeader()
           
 boolean isFirstLineHeader()
           
static BinaryClassificationPerformance newInstance(java.lang.String name)
           
 void prepareReporting()
           
 void startCounting(ExampleSet eSet, boolean useExampleWeights)
          Initializes the criterion.
 java.lang.String toString()
           
 
Methods inherited from class com.rapidminer.operator.performance.MeasuredPerformance
startCounting
 
Methods inherited from class com.rapidminer.operator.performance.PerformanceCriterion
compareTo
 
Methods inherited from class com.rapidminer.tools.math.Averagable
buildAverage, clone, cloneAveragable, getAverage, getAverageCount, getExtension, getFileDescription, getMakroAverage, getMakroStandardDeviation, getMakroVariance, getMikroStandardDeviation, getStandardDeviation, getVariance, setAverageCount
 
Methods inherited from class com.rapidminer.operator.ResultObjectAdapter
addAction, getActions, getResultIcon, isSavable, log, logError, logNote, logWarning, save, toHTML, toResultString
 
Methods inherited from class com.rapidminer.operator.AbstractIOObject
copy, getLog, getSource, initWriting, read, setLoggingHandler, setSource, write
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.rapidminer.operator.IOObject
copy, getLog, getSource, setLoggingHandler, setSource, write
 

Field Detail

PRECISION

public static final int PRECISION
See Also:
Constant Field Values

RECALL

public static final int RECALL
See Also:
Constant Field Values

LIFT

public static final int LIFT
See Also:
Constant Field Values

FALLOUT

public static final int FALLOUT
See Also:
Constant Field Values

F_MEASURE

public static final int F_MEASURE
See Also:
Constant Field Values

FALSE_POSITIVE

public static final int FALSE_POSITIVE
See Also:
Constant Field Values

FALSE_NEGATIVE

public static final int FALSE_NEGATIVE
See Also:
Constant Field Values

TRUE_POSITIVE

public static final int TRUE_POSITIVE
See Also:
Constant Field Values

TRUE_NEGATIVE

public static final int TRUE_NEGATIVE
See Also:
Constant Field Values

SENSITIVITY

public static final int SENSITIVITY
See Also:
Constant Field Values

SPECIFICITY

public static final int SPECIFICITY
See Also:
Constant Field Values

YOUDEN

public static final int YOUDEN
See Also:
Constant Field Values

POSITIVE_PREDICTIVE_VALUE

public static final int POSITIVE_PREDICTIVE_VALUE
See Also:
Constant Field Values

NEGATIVE_PREDICTIVE_VALUE

public static final int NEGATIVE_PREDICTIVE_VALUE
See Also:
Constant Field Values

PSEP

public static final int PSEP
See Also:
Constant Field Values

NAMES

public static final java.lang.String[] NAMES

DESCRIPTIONS

public static final java.lang.String[] DESCRIPTIONS
Constructor Detail

BinaryClassificationPerformance

public BinaryClassificationPerformance()

BinaryClassificationPerformance

public BinaryClassificationPerformance(BinaryClassificationPerformance o)

BinaryClassificationPerformance

public BinaryClassificationPerformance(int type)

BinaryClassificationPerformance

public BinaryClassificationPerformance(int type,
                                       double[][] counter)
For test cases only.

Method Detail

newInstance

public static BinaryClassificationPerformance newInstance(java.lang.String name)

getExampleCount

public double getExampleCount()
Description copied from class: PerformanceCriterion
Returns the number of data points which was used to determine the criterion value. If the criterion does not use example weights (or no weight was given) then the returned value will be an integer. Otherwise, the returned value is the sum of all example weights.

Specified by:
getExampleCount in class PerformanceCriterion

startCounting

public void startCounting(ExampleSet eSet,
                          boolean useExampleWeights)
                   throws OperatorException
Description copied from class: MeasuredPerformance
Initializes the criterion. The default implementation does nothing.

Overrides:
startCounting in class MeasuredPerformance
Throws:
OperatorException

countExample

public void countExample(Example example)
Description copied from class: MeasuredPerformance
Counts a single example, e.g. by summing up errors.

Specified by:
countExample in class MeasuredPerformance

getMikroAverage

public double getMikroAverage()
Description copied from class: Averagable
Returns the (current) value of the averagable (the average itself). If the method Averagable.buildSingleAverage(Averagable) was used, this method must return the micro average from both (or more) criteria. This is usually achieved by correctly implementing Averagable.buildSingleAverage(Averagable).

Specified by:
getMikroAverage in class Averagable

getFitness

public double getFitness()
Description copied from class: PerformanceCriterion

Returns the fitness depending on the value. The fitness values will be used for all optimization purposes (feature space transformations, parameter optimizations...) and must always be maximized. Hence, if your criterion is better the smaller the value is you should return something like (-1 * value) or (1 / value).

Subclasses should use Averagable.getAverage() instead of Averagable.getMikroAverage() in this method since usually the makro average (if available) should be optmized instead of the mikro average. The mikro average should only be used in the (rare) cases where no makro average is available but this is automatically done returned by Averagable.getAverage() in these cases.

Specified by:
getFitness in class PerformanceCriterion

getMaxFitness

public double getMaxFitness()
Description copied from class: PerformanceCriterion
Returns the maximum fitness. The default implementation resturns POSITIVE_INFINITY, subclasses may override this to allow feature operators to end the optimization if the maximum was reached.

Overrides:
getMaxFitness in class PerformanceCriterion

getMikroVariance

public double getMikroVariance()
Description copied from class: Averagable
Returns the variance of the averagable. The returned value must not be negative. If the averagable does not define a variance this method should return Double.NaN.

Specified by:
getMikroVariance in class Averagable

getName

public java.lang.String getName()
Description copied from class: Averagable
Returns the name of this averagable. The returned string should only contain lowercase letters and underscore (RapidMiner parameter format) since the names will be automatically used for GUI purposes.

Specified by:
getName in interface ResultObject
Specified by:
getName in class Averagable

getDescription

public java.lang.String getDescription()
Description copied from class: PerformanceCriterion
Returns a description of the performance criterion. This description is used for GUI purposes and automatic parameter type creation for the PerformanceEvaluator operator.

Specified by:
getDescription in class PerformanceCriterion

formatPercent

public boolean formatPercent()
Description copied from class: Averagable
Indicates wether or not percentage format should be used in the Averagable.toString() method. The default implementation returns false.

Overrides:
formatPercent in class Averagable

buildSingleAverage

public void buildSingleAverage(Averagable performance)
Description copied from class: Averagable
This method should build the average of this and another averagable of the same type. The next invocation of Averagable.getMikroAverage() should return the average of this and the given averagable. Hence, this method is used to build the actual micro average value of two criteria. Please refer to SimpleCriterion for a simple implementation example.

Specified by:
buildSingleAverage in class Averagable

toString

public java.lang.String toString()
Specified by:
toString in interface Readable
Overrides:
toString in class Averagable

getVisualizationComponent

public java.awt.Component getVisualizationComponent(IOContainer ioContainer)
This implementation returns a confusion matrix viewer based on a JTable.

Specified by:
getVisualizationComponent in interface ResultObject
Overrides:
getVisualizationComponent in class Averagable

prepareReporting

public void prepareReporting()
Specified by:
prepareReporting in interface Tableable

finishReporting

public void finishReporting()
Specified by:
finishReporting in interface Tableable

getColumnName

public java.lang.String getColumnName(int columnIndex)
Specified by:
getColumnName in interface Tableable

getCell

public java.lang.String getCell(int row,
                                int column)
Specified by:
getCell in interface Tableable

getColumnNumber

public int getColumnNumber()
Specified by:
getColumnNumber in interface Tableable

getRowNumber

public int getRowNumber()
Specified by:
getRowNumber in interface Tableable

isFirstLineHeader

public boolean isFirstLineHeader()
Specified by:
isFirstLineHeader in interface Tableable

isFirstColumnHeader

public boolean isFirstColumnHeader()
Specified by:
isFirstColumnHeader in interface Tableable


Copyright © 2001-2009 by Rapid-I