code: public void evaluate(ObjectStream<DocSample> samples, int nFolds)
        throws IOException {
  
      CrossValidationPartitioner<DocSample> partitioner = new CrossValidationPartitioner<>(
          samples, nFolds);
  
      while (partitioner.hasNext()) {
  
        CrossValidationPartitioner.TrainingSampleStream<DocSample> trainingSampleStream = partitioner
            .next();
  
        DocumentClassifierModel model = DocumentClassifierME.train(languageCode,
            trainingSampleStream, params, factory);
  
        DocumentClassifierEvaluator evaluator = new DocumentClassifierEvaluator(
            new DocumentClassifierME(model), listeners);
  
        evaluator.evaluate(trainingSampleStream.getTestSampleStream());
  
        documentAccuracy.add(evaluator.getAccuracy(),
            evaluator.getDocumentCount());
  
      }
    }
docs: Starts the evaluation.
  
  @param samples
  the data to train and test
  @param nFolds
  number of folds
  
  @throws IOException if io error