org.apache.mahout.classifier
Class ConfusionMatrix
java.lang.Object
org.apache.mahout.classifier.ConfusionMatrix
public class ConfusionMatrix
- extends Object
The ConfusionMatrix Class stores the result of Classification of a Test Dataset.
The fact of whether there is a default is not stored. A row of zeros is the only indicator that there is no default.
See http://en.wikipedia.org/wiki/Confusion_matrix for background
ConfusionMatrix
public ConfusionMatrix(Collection<String> labels,
String defaultLabel)
ConfusionMatrix
public ConfusionMatrix(Matrix m)
getConfusionMatrix
public int[][] getConfusionMatrix()
getLabels
public Collection<String> getLabels()
getAccuracy
public double getAccuracy(String label)
getCorrect
public int getCorrect(String label)
getTotal
public int getTotal(String label)
addInstance
public void addInstance(String correctLabel,
ClassifierResult classifiedResult)
addInstance
public void addInstance(String correctLabel,
String classifiedLabel)
getCount
public int getCount(String correctLabel,
String classifiedLabel)
putCount
public void putCount(String correctLabel,
String classifiedLabel,
int count)
getDefaultLabel
public String getDefaultLabel()
incrementCount
public void incrementCount(String correctLabel,
String classifiedLabel,
int count)
incrementCount
public void incrementCount(String correctLabel,
String classifiedLabel)
merge
public ConfusionMatrix merge(ConfusionMatrix b)
getMatrix
public Matrix getMatrix()
setMatrix
public void setMatrix(Matrix m)
toString
public String toString()
- This is overloaded. toString() is not a formatted report you print for a manager :)
Assume that if there are no default assignments, the default feature was not used
- Overrides:
toString
in class Object
Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.