[ 
https://issues.apache.org/jira/browse/OPENNLP-1017?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16118310#comment-16118310
 ] 

Neil Ireson commented on OPENNLP-1017:
--------------------------------------

This is the code that works for me, it completely removes the 
NameToDocumentSampleStream wrapping...

{code:java}
        CrossValidationPartitioner<NameSample> partitioner = new 
CrossValidationPartitioner<>(sampleStream, nFolds);

        FMeasure fmeasure = new FMeasure();
        while (partitioner.hasNext()) {

            CrossValidationPartitioner.TrainingSampleStream<NameSample> 
trainingSampleStream = partitioner.next();

            TokenNameFinderModel model = NameFinderME.train(lang, entity, 
trainingSampleStream,
                        params, tokenNameFinderFactory);

            // do testing
            TokenNameFinderEvaluator evaluator = new 
TokenNameFinderEvaluator(new NameFinderME(model));

            evaluator.evaluate(trainingSampleStream.getTestSampleStream());

            fmeasure.mergeInto(evaluator.getFMeasure());
        }

        return fmeasure;
{code}

> OpenNlp NameFinderCrossValidation gives InsufficientTrainingDataException
> -------------------------------------------------------------------------
>
>                 Key: OPENNLP-1017
>                 URL: https://issues.apache.org/jira/browse/OPENNLP-1017
>             Project: OpenNLP
>          Issue Type: Bug
>            Reporter: Saurabh Jain
>
> OpenNlp NameFinderCrossValidation gives InsufficientTrainingDataException.
> With nfold value 3, I tried to cross validate NameFinder training data. After 
> doing a research I got to know that first partition is assinged null data.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to