com.mancrd.ahah.classifier
Class ClassificationEvaluator

java.lang.Object
  extended by com.mancrd.ahah.classifier.ClassificationEvaluator

public class ClassificationEvaluator
extends Object

Used to keep track of classification performance.

Author:
alexnugent

Constructor Summary
ClassificationEvaluator()
           
ClassificationEvaluator(Set<String> labels)
          Constructor Must provide a set of labels that will be used for evaluation.
 
Method Summary
 double getAccuracyMacroAve()
           
 double getAccuracyMicroAve()
           
 ClassificationRate getClassificationRate(String trueLabel)
          calculates the classification rate for a single trueLabelId
 double getF1MacroAve()
           
 double getF1MicroAve()
           
 double getPrecisionMacroAve()
           
 double getPrecisionMicroAve()
           
 double getRecallMacroAve()
           
 double getRecallMicroAve()
           
 List<ClassificationRate> getSortedClassificationRates()
           
 String toString()
           
 void update(Set<String> trueLabels, List<String> labels)
          Here's where results come in
 void update(String trueLabel, String label)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassificationEvaluator

public ClassificationEvaluator()

ClassificationEvaluator

public ClassificationEvaluator(Set<String> labels)
Constructor Must provide a set of labels that will be used for evaluation. Other labels will be ignored for evaluation.

Method Detail

update

public void update(String trueLabel,
                   String label)
Parameters:
trueLabel: - the actual (supervised) label.
label: - the label given by the classifier.

update

public void update(Set<String> trueLabels,
                   List<String> labels)
Here's where results come in

Parameters:
trueLabels: - the supervised labels
labels: - the labels given by the classifier.

getClassificationRate

public ClassificationRate getClassificationRate(String trueLabel)
calculates the classification rate for a single trueLabelId

Parameters:
trueLabel -
Returns:
double - the classification for a single trueLabel.

getF1MicroAve

public double getF1MicroAve()
Returns:
micro-averaged F1 score. F1=2*TP/(2*TP+FP FN)

getRecallMicroAve

public double getRecallMicroAve()
Returns:
micro-averaged recall score. Recall=TP/(TP+FN)

getPrecisionMicroAve

public double getPrecisionMicroAve()
Returns:
micro-averaged precision score. Precision=TP/(TP+FP)

getAccuracyMicroAve

public double getAccuracyMicroAve()
Returns:
micro averaged accuracy. Accuracy=(TP+TN)/(TP+FP+TN+FN)

getF1MacroAve

public double getF1MacroAve()
Returns:
macro-averaged F1 score. F1=TP/(2*TP+FP FN)

getRecallMacroAve

public double getRecallMacroAve()
Returns:
macro-averaged recall score. Recall=TP/(TP+FN)

getPrecisionMacroAve

public double getPrecisionMacroAve()
Returns:
macro-averaged precision score. Precision=TP/(TP+FP)

getAccuracyMacroAve

public double getAccuracyMacroAve()
Returns:
macro averaged accuracy. Accuracy=(TP+TN)/(TP+FP+TN+FN)

getSortedClassificationRates

public List<ClassificationRate> getSortedClassificationRates()
Returns:
a List of all ClassificationRate objects holding data for each label.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013–2014 M. Alexander Nugent Consulting, Research and Devlopment. All rights reserved.