gov.sandia.cognition.learning.performance
Class MeanZeroOneErrorEvaluator<InputType,DataType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.performance.AbstractSupervisedPerformanceEvaluator<InputType,TargetType,TargetType,Double>
          extended by gov.sandia.cognition.learning.function.cost.AbstractSupervisedCostFunction<InputType,DataType>
              extended by gov.sandia.cognition.learning.performance.MeanZeroOneErrorEvaluator<InputType,DataType>
Type Parameters:
InputType - The type of the input to the evaluator to compute the performance of.
DataType - The type of the target and estimate values.
All Implemented Interfaces:
Evaluator<Evaluator<? super InputType,? extends DataType>,Double>, CostFunction<Evaluator<? super InputType,? extends DataType>,Collection<? extends InputOutputPair<? extends InputType,DataType>>>, SupervisedCostFunction<InputType,DataType>, PerformanceEvaluator<Evaluator<? super InputType,? extends DataType>,Collection<? extends InputOutputPair<InputType,DataType>>,Double>, SupervisedPerformanceEvaluator<InputType,DataType,DataType,Double>, CloneableSerializable, Summarizer<TargetEstimatePair<? extends DataType,? extends DataType>,Double>, Serializable, Cloneable

public class MeanZeroOneErrorEvaluator<InputType,DataType>
extends AbstractSupervisedCostFunction<InputType,DataType>

The MeanZeroOneErrorEvaluator class implements a method for computing the performance of a supervised learner by the mean number of incorrect values between the target and estimated outputs. This can also be referred to as the error rate. The term "mean zero-one error" comes from the computation that the error is zero if the two values are equal and one if the two values are not equal. This class can be used with any data type that has a valid equals method.

Since:
2.0
Author:
Justin Basilico
See Also:
Serialized Form

Constructor Summary
MeanZeroOneErrorEvaluator()
          Creates a new instance of MeanZeroOneErrorEvaluator.
 
Method Summary
static
<DataType> double
compute(Collection<? extends TargetEstimatePair<? extends DataType,? extends DataType>> data)
          Computes the mean zero-one loss for the given pairs of values.
 Double evaluatePerformance(Collection<? extends TargetEstimatePair<? extends DataType,? extends DataType>> data)
          Evaluates the performance accuracy of the given estimates against the given targets.
 
Methods inherited from class gov.sandia.cognition.learning.function.cost.AbstractSupervisedCostFunction
clone, evaluate, getCostParameters, setCostParameters, summarize
 
Methods inherited from class gov.sandia.cognition.learning.performance.AbstractSupervisedPerformanceEvaluator
evaluatePerformance
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.learning.performance.PerformanceEvaluator
evaluatePerformance
 

Constructor Detail

MeanZeroOneErrorEvaluator

public MeanZeroOneErrorEvaluator()
Creates a new instance of MeanZeroOneErrorEvaluator.

Method Detail

evaluatePerformance

public Double evaluatePerformance(Collection<? extends TargetEstimatePair<? extends DataType,? extends DataType>> data)
Evaluates the performance accuracy of the given estimates against the given targets.

Specified by:
evaluatePerformance in interface SupervisedPerformanceEvaluator<InputType,DataType,DataType,Double>
Specified by:
evaluatePerformance in class AbstractSupervisedCostFunction<InputType,DataType>
Parameters:
data - The target-estimate pairs to use to evaluate performance.
Returns:
The performance evaluation result.

compute

public static <DataType> double compute(Collection<? extends TargetEstimatePair<? extends DataType,? extends DataType>> data)
Computes the mean zero-one loss for the given pairs of values. The error is defined to be 0.0 if the two values are the same and 1.0 otherwise. The mean of this error computed over all the data points is returned.

Type Parameters:
DataType - The type of data to compute the estimate over.
Parameters:
data - The data to compute the error for.
Returns:
The mean zero-one error.