Class ConfusionMatrixGenerator.ConfusionMatrix
java.lang.Object
org.apache.lucene.classification.utils.ConfusionMatrixGenerator.ConfusionMatrix
- Enclosing class:
ConfusionMatrixGenerator
a confusion matrix, backed by a
Map representing the linearized matrix-
Method Summary
Modifier and TypeMethodDescriptiondoubleCalculate accuracy on this confusion matrix using the formula: accuracy = correctly-classified / (correctly-classified + wrongly-classified)doubleget the average classification time in millisecondsdoubleget the F-1 measure on this confusion matrixdoublegetF1Measure(String klass) get the F-1 measure of the given classget the linearized confusion matrix as aMapintget the no.doubleget the macro averaged precision (seegetPrecision(String)) over all the classes.doublegetPrecision(String klass) calculate precision on the given classdoubleget the macro averaged recall (seegetRecall(String)) over all the classesdoublecalculate recall on the given classtoString()
-
Method Details
-
getLinearizedMatrix
get the linearized confusion matrix as aMap- Returns:
- a
Mapwhose keys are the correct classification answers and whose values are the actual answers' counts
-
getPrecision
calculate precision on the given class- Parameters:
klass- the class to calculate the precision for- Returns:
- the precision for the given class
-
getRecall
calculate recall on the given class- Parameters:
klass- the class to calculate the recall for- Returns:
- the recall for the given class
-
getF1Measure
get the F-1 measure of the given class- Parameters:
klass- the class to calculate the F-1 measure for- Returns:
- the F-1 measure for the given class
-
getF1Measure
public double getF1Measure()get the F-1 measure on this confusion matrix- Returns:
- the F-1 measure
-
getAccuracy
public double getAccuracy()Calculate accuracy on this confusion matrix using the formula: accuracy = correctly-classified / (correctly-classified + wrongly-classified)- Returns:
- the accuracy
-
getPrecision
public double getPrecision()get the macro averaged precision (seegetPrecision(String)) over all the classes.- Returns:
- the macro averaged precision as computed from the confusion matrix
-
getRecall
public double getRecall()get the macro averaged recall (seegetRecall(String)) over all the classes- Returns:
- the recall as computed from the confusion matrix
-
toString
-
getAvgClassificationTime
public double getAvgClassificationTime()get the average classification time in milliseconds- Returns:
- the avg classification time
-
getNumberOfEvaluatedDocs
public int getNumberOfEvaluatedDocs()get the no. of documents evaluated while generating this confusion matrix- Returns:
- the no. of documents evaluated
-