Package opennlp.tools.langdetect
Class LanguageDetectorCrossValidator
- java.lang.Object
-
- opennlp.tools.langdetect.LanguageDetectorCrossValidator
-
public class LanguageDetectorCrossValidator extends Object
Cross validator forLanguageDetector
.
-
-
Constructor Summary
Constructors Constructor Description LanguageDetectorCrossValidator(TrainingParameters mlParams, LanguageDetectorFactory factory, LanguageDetectorEvaluationMonitor... listeners)
Initializes aLanguageDetectorCrossValidator
with the givenparameters
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
evaluate(ObjectStream<LanguageSample> samples, int nFolds)
Starts the evaluation.double
getDocumentAccuracy()
long
getDocumentCount()
-
-
-
Constructor Detail
-
LanguageDetectorCrossValidator
public LanguageDetectorCrossValidator(TrainingParameters mlParams, LanguageDetectorFactory factory, LanguageDetectorEvaluationMonitor... listeners)
Initializes aLanguageDetectorCrossValidator
with the givenparameters
.- Parameters:
mlParams
- TheTrainingParameters
for the context of cross validation.factory
- TheLanguageDetectorFactory
for creating related objects.listeners
- theevaluation listeners
.
-
-
Method Detail
-
evaluate
public void evaluate(ObjectStream<LanguageSample> samples, int nFolds) throws IOException
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 word 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.
-
-