Package opennlp.tools.doccat
Class DoccatCrossValidator
java.lang.Object
opennlp.tools.doccat.DoccatCrossValidator
Cross validator for
DocumentCategorizer
.-
Constructor Summary
ConstructorDescriptionDoccatCrossValidator
(String languageCode, TrainingParameters mlParams, DoccatFactory factory, DoccatEvaluationMonitor... listeners) Instantiates aDoccatCrossValidator
with the givengenerators
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
evaluate
(ObjectStream<DocumentSample> samples, int nFolds) Starts the evaluation.double
long
-
Constructor Details
-
DoccatCrossValidator
public DoccatCrossValidator(String languageCode, TrainingParameters mlParams, DoccatFactory factory, DoccatEvaluationMonitor... listeners) Instantiates aDoccatCrossValidator
with the givengenerators
.- Parameters:
languageCode
- An ISO conform language code.mlParams
- TheTrainingParameters
for the context of cross validation.factory
- TheDoccatFactory
for creating related objects.listeners
- theevaluation listeners
.
-
-
Method Details
-
evaluate
Starts the evaluation.- Parameters:
samples
- TheObjectStream
ofsamples
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.
-