com.rapidminer.operator.performance
Class WeightedMultiClassPerformance

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

public class WeightedMultiClassPerformance
extends MeasuredPerformance
implements ClassWeightedPerformance

Measures the weighted mean of all per class recalls or per class precisions based on the weights defined in the performance evaluator.

Author:
Ingo Mierswa
See Also:
Serialized Form

Field Summary
static java.lang.String[] DESCRIPTIONS
          The descriptions of the criteria.
static java.lang.String[] NAMES
          The names of the criteria.
static int UNDEFINED
          Indicates an undefined type (should not happen).
static int WEIGHTED_PRECISION
          Indicates classification error.
static int WEIGHTED_RECALL
          Indicates accuracy.
 
Constructor Summary
WeightedMultiClassPerformance()
          Creates a WeightedMultiClassPerformance with undefined type.
WeightedMultiClassPerformance(int type)
          Creates a WeightedMultiClassPerformance with the given type.
WeightedMultiClassPerformance(WeightedMultiClassPerformance m)
           
 
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 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.awt.Component getVisualizationComponent(IOContainer ioContainer)
          This implementation returns a confusion matrix viewer based on a JTable.
static WeightedMultiClassPerformance newInstance(java.lang.String name)
          Creates a WeightedMultiClassPerformance with the given type.
 void setWeights(double[] weights)
          Sets the class weights.
 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, 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

UNDEFINED

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

See Also:
Constant Field Values

WEIGHTED_RECALL

public static final int WEIGHTED_RECALL
Indicates accuracy.

See Also:
Constant Field Values

WEIGHTED_PRECISION

public static final int WEIGHTED_PRECISION
Indicates classification error.

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

WeightedMultiClassPerformance

public WeightedMultiClassPerformance()
Creates a WeightedMultiClassPerformance with undefined type.


WeightedMultiClassPerformance

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


WeightedMultiClassPerformance

public WeightedMultiClassPerformance(WeightedMultiClassPerformance m)
Method Detail

newInstance

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


setWeights

public void setWeights(double[] weights)
Sets the class weights.

Specified by:
setWeights in interface ClassWeightedPerformance

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

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

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

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

toString

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


Copyright © 2001-2009 by Rapid-I