org.apache.lucene.classification.utils

## Class ConfusionMatrixGenerator

- java.lang.Object
- - org.apache.lucene.classification.utils.ConfusionMatrixGenerator

-     public class ConfusionMatrixGenerator
      extends Object

  Utility class to generate the confusion matrix of a `Classifier`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ConfusionMatrixGenerator.ConfusionMatrix` a confusion matrix, backed by a `Map` representing the linearized matrix

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T> ConfusionMatrixGenerator.ConfusionMatrix` | `getConfusionMatrix(IndexReader reader, Classifier<T> classifier, String classFieldName, String textFieldName, long timeoutMilliseconds)` get the `ConfusionMatrixGenerator.ConfusionMatrix` of a given `Classifier`, generated on the given `IndexReader`, class and text fields.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### getConfusionMatrix

          public static <T> ConfusionMatrixGenerator.ConfusionMatrix getConfusionMatrix(IndexReader reader,
                                                                                        Classifier<T> classifier,
                                                                                        String classFieldName,
                                                                                        String textFieldName,
                                                                                        long timeoutMilliseconds)
                                                                                 throws IOException

      get the `ConfusionMatrixGenerator.ConfusionMatrix` of a given `Classifier`, generated on the given `IndexReader`, class and text fields.
      Type Parameters:
        `T` - the return type of the `ClassificationResult` returned by the given `Classifier`
      Parameters:
        `reader` - the `IndexReader` containing the index used for creating the `Classifier`
        `classifier` - the `Classifier` whose confusion matrix has to be generated
        `classFieldName` - the name of the Lucene field used as the classifier's output
        `textFieldName` - the nome the Lucene field used as the classifier's input
        `timeoutMilliseconds` - 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

Copyright © 2000-2024 Apache Software Foundation. All Rights Reserved.