com.rapidminer.operator.performance
Class MultiClassificationPerformance

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.MultiClassificationPerformance
All Implemented Interfaces:
IOObject, ResultObject, Readable, Reportable, LoggingHandler, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<PerformanceCriterion>

public class MultiClassificationPerformance
extends MeasuredPerformance

Measures the accuracy and classification error for both binary classification problems and multi class problems. Additionally, this performance criterion can also compute the kappa statistics for multi class problems. This is calculated as k = (P(A) - P(E)) / (1 - P(E)) with [ P(A) = diagonal sum / number of examples ] and [ P(E) = sum over i of ((sum of i-th row * sum of i-th column) / (n to the power of 2) ].

Author:
Ingo Mierswa
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.rapidminer.operator.AbstractIOObject
AbstractIOObject.InputStreamProvider
 
Field Summary
static int ACCURACY
          Indicates accuracy.
static java.lang.String[] DESCRIPTIONS
          The descriptions of the criteria.
static int ERROR
          Indicates classification error.
static int KAPPA
          Indicates kappa statistics.
static java.lang.String[] NAMES
          The names of the criteria.
static int UNDEFINED
          Indicates an undefined type (should not happen).
 
Constructor Summary
MultiClassificationPerformance()
          Creates a MultiClassificationPerformance with undefined type.
MultiClassificationPerformance(int type)
          Creates a MultiClassificationPerformance with the given type.
MultiClassificationPerformance(MultiClassificationPerformance m)
          Clone constructor.
 
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)
          Increases the prediction value in the matrix.
 boolean formatPercent()
          Returns true.
 java.lang.String[] getClassNames()
           
 double[][] getCounter()
           
 java.lang.String getDescription()
          Returns the description.
 double getExampleCount()
          Returns the number of data points which was used to determine the criterion value.
 double getFitness()
          Returns the accuracy or 1 - error.
 double getMaxFitness()
          Returns 1.
 double getMikroAverage()
          Returns either the accuracy or the classification error.
 double getMikroVariance()
          Returns the variance of the averagable.
 java.lang.String getName()
          Returns the name.
 java.lang.String getTitle()
           
static MultiClassificationPerformance newInstance(java.lang.String name)
          Creates a MultiClassificationPerformance with the given type.
 void startCounting(ExampleSet eSet, boolean useExampleWeights)
          Initializes the criterion and sets the label.
 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, isInTargetEncoding, setAverageCount
 
Methods inherited from class com.rapidminer.operator.ResultObjectAdapter
addAction, getActions, getAnnotations, getResultIcon, log, log, logError, logNote, logWarning, toHTML, toResultString
 
Methods inherited from class com.rapidminer.operator.AbstractIOObject
appendOperatorToHistory, copy, getLog, getProcessingHistory, getSource, initWriting, read, read, read, 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
appendOperatorToHistory, copy, getLog, getProcessingHistory, getSource, setLoggingHandler, setSource, write
 

Field Detail

UNDEFINED

public static final int UNDEFINED
Indicates an undefined type (should not happen).

See Also:
Constant Field Values

ACCURACY

public static final int ACCURACY
Indicates accuracy.

See Also:
Constant Field Values

ERROR

public static final int ERROR
Indicates classification error.

See Also:
Constant Field Values

KAPPA

public static final int KAPPA
Indicates kappa statistics.

See Also:
Constant Field Values

NAMES

public static final java.lang.String[] NAMES
The names of the criteria.


DESCRIPTIONS

public static final java.lang.String[] DESCRIPTIONS
The descriptions of the criteria.

Constructor Detail

MultiClassificationPerformance

public MultiClassificationPerformance()
Creates a MultiClassificationPerformance with undefined type.


MultiClassificationPerformance

public MultiClassificationPerformance(int type)
Creates a MultiClassificationPerformance with the given type.


MultiClassificationPerformance

public MultiClassificationPerformance(MultiClassificationPerformance m)
Clone constructor.

Method Detail

newInstance

public static MultiClassificationPerformance newInstance(java.lang.String name)
Creates a MultiClassificationPerformance with the given type.


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
Initializes the criterion and sets the label.

Overrides:
startCounting in class MeasuredPerformance
Throws:
OperatorException

countExample

public void countExample(Example example)
Increases the prediction value in the matrix.

Specified by:
countExample in class MeasuredPerformance

getMikroAverage

public double getMikroAverage()
Returns either the accuracy or the classification error.

Specified by:
getMikroAverage in class Averagable

formatPercent

public boolean formatPercent()
Returns true.

Overrides:
formatPercent in class Averagable

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()
Returns the name.

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

getDescription

public java.lang.String getDescription()
Returns the description.

Specified by:
getDescription in class PerformanceCriterion

getFitness

public double getFitness()
Returns the accuracy or 1 - error.

Specified by:
getFitness in class PerformanceCriterion

getMaxFitness

public double getMaxFitness()
Returns 1.

Overrides:
getMaxFitness in class PerformanceCriterion

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

getTitle

public java.lang.String getTitle()

getClassNames

public java.lang.String[] getClassNames()

getCounter

public double[][] getCounter()


Copyright © 2001-2009 by Rapid-I