Package opennlp.tools.doccat

# Class DoccatCrossValidator

java.lang.Object
opennlp.tools.doccat.DoccatCrossValidator

public class DoccatCrossValidator extends Object
Cross validator for `DocumentCategorizer`.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DoccatCrossValidator(String languageCode, TrainingParameters mlParams, DoccatFactory factory, DoccatEvaluationMonitor... listeners)`
  Instantiates a `DoccatCrossValidator` with the given `generators`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `evaluate(ObjectStream<DocumentSample> samples, int nFolds)`
  Starts the evaluation.
  `double`
  `getDocumentAccuracy()`
  `long`
  `getDocumentCount()`

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

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

- ## Constructor Details

  - ### DoccatCrossValidator

    public DoccatCrossValidator(String languageCode, TrainingParameters mlParams, DoccatFactory factory, DoccatEvaluationMonitor... listeners)
    Instantiates a `DoccatCrossValidator` with the given `generators`.
    Parameters:
      `languageCode` - An ISO conform language code.
      `mlParams` - The `TrainingParameters` for the context of cross validation.
      `factory` - The `DoccatFactory` for creating related objects.
      `listeners` - the `evaluation listeners`.

- ## Method Details

  - ### evaluate

    public void evaluate(ObjectStream<DocumentSample> samples, int nFolds) throws IOException
    Starts the evaluation.
    Parameters:
      `samples` - The `ObjectStream` of `samples` to train and test with.
      `nFolds` - Number of folds. It must be greater than zero.
    Throws:
      `IOException` - Thrown if IO errors occurred.

  - ### getDocumentAccuracy

    public double getDocumentAccuracy()
    Returns:
      Retrieves the accuracy for all iterations.

  - ### getDocumentCount

    public long getDocumentCount()
    Returns:
      Retrieves the number of words which where validated over all iterations. The result is the amount of folds multiplied by the total number of words.