Class ConfusionMatrixGenerator
java.lang.Object
org.apache.lucene.classification.utils.ConfusionMatrixGenerator
Utility class to generate the confusion matrix of a
Classifier-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classa confusion matrix, backed by aMaprepresenting the linearized matrix -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ConfusionMatrixGenerator.ConfusionMatrixgetConfusionMatrix(IndexReader reader, Classifier<T> classifier, String classFieldName, String textFieldName, long timeoutMilliseconds) get theConfusionMatrixGenerator.ConfusionMatrixof 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.ConfusionMatrixof a givenClassifier, generated on the givenIndexReader, class and text fields.- Type Parameters:
T- the return type of theClassificationResultreturned by the givenClassifier- Parameters:
reader- theIndexReadercontaining the index used for creating theClassifierclassifier- theClassifierwhose 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
-