Class ConfusionMatrixGenerator.ConfusionMatrix
- java.lang.Object
-
- org.apache.lucene.classification.utils.ConfusionMatrixGenerator.ConfusionMatrix
-
- Enclosing class:
- ConfusionMatrixGenerator
public static class ConfusionMatrixGenerator.ConfusionMatrix extends Object
a confusion matrix, backed by aMap
representing the linearized matrix
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getAccuracy()
Calculate accuracy on this confusion matrix using the formula: accuracy = correctly-classified / (correctly-classified + wrongly-classified)double
getAvgClassificationTime()
get the average classification time in millisecondsdouble
getF1Measure()
get the F-1 measure on this confusion matrixdouble
getF1Measure(String klass)
get the F-1 measure of the given classMap<String,Map<String,Long>>
getLinearizedMatrix()
get the linearized confusion matrix as aMap
int
getNumberOfEvaluatedDocs()
get the no.double
getPrecision()
get the macro averaged precision (seegetPrecision(String)
) over all the classes.double
getPrecision(String klass)
calculate precision on the given classdouble
getRecall()
get the macro averaged recall (seegetRecall(String)
) over all the classesdouble
getRecall(String klass)
calculate recall on the given classString
toString()
-
-
-
Method Detail
-
getLinearizedMatrix
public Map<String,Map<String,Long>> getLinearizedMatrix()
get the linearized confusion matrix as aMap
- Returns:
- a
Map
whose keys are the correct classification answers and whose values are the actual answers' counts
-
getPrecision
public double getPrecision(String klass)
calculate precision on the given class- Parameters:
klass
- the class to calculate the precision for- Returns:
- the precision for the given class
-
getRecall
public double getRecall(String klass)
calculate recall on the given class- Parameters:
klass
- the class to calculate the recall for- Returns:
- the recall for the given class
-
getF1Measure
public double getF1Measure(String klass)
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
-
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
-
-