Class ConfusionMatrixGenerator
java.lang.Object
org.apache.lucene.classification.utils.ConfusionMatrixGenerator
Utility class to generate the confusion matrix of a
Classifier
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
a confusion matrix, backed by aMap
representing the linearized matrix -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ConfusionMatrixGenerator.ConfusionMatrix
getConfusionMatrix
(IndexReader reader, Classifier<T> classifier, String classFieldName, String textFieldName, long timeoutMilliseconds) get theConfusionMatrixGenerator.ConfusionMatrix
of a givenClassifier
, generated on the givenIndexReader
, class and text fields.
-
Method Details
-
getConfusionMatrix
public static <T> ConfusionMatrixGenerator.ConfusionMatrix getConfusionMatrix(IndexReader reader, Classifier<T> classifier, String classFieldName, String textFieldName, long timeoutMilliseconds) throws IOException get theConfusionMatrixGenerator.ConfusionMatrix
of a givenClassifier
, generated on the givenIndexReader
, class and text fields.- Type Parameters:
T
- the return type of theClassificationResult
returned by the givenClassifier
- Parameters:
reader
- theIndexReader
containing the index used for creating theClassifier
classifier
- theClassifier
whose confusion matrix has to be generatedclassFieldName
- the name of the Lucene field used as the classifier's outputtextFieldName
- the nome the Lucene field used as the classifier's inputtimeoutMilliseconds
- timeout to wait before stopping creating the confusion matrix- Returns:
- a
ConfusionMatrixGenerator.ConfusionMatrix
- Throws:
IOException
- if problems occurr while reading the index or using the classifier
-