Package cc.mallet.classify

Examples of cc.mallet.classify.Trial


      }
    }
   
    // evaluate token classifier 
    if (testList != null) {
      Trial trial = new Trial(m_tokenClassifiers, testList);
      logger.info("Token classifier accuracy on test set = " + trial.getAccuracy());
    }
  }
View Full Code Here


    {
      // train a classifier on the entire training set
      logger.info("Training token classifier on entire data set (size=" + trainList.size() + ")...");
      m_tokenClassifier = m_trainer.train(trainList);

      Trial t = new Trial(m_tokenClassifier, trainList);
      logger.info("Training set accuracy = " + t.getAccuracy());
     
      if (m_numCV == 0)
        return;

      // train classifiers using cross validation
      InstanceList.CrossValidationIterator cvIter = trainList.new CrossValidationIterator(m_numCV, m_randSeed);
      int f = 1;

      while (cvIter.hasNext()) {
        f++;
        InstanceList[] fold = cvIter.nextSplit();

        logger.info("Training token classifier on cv fold " + f + " / " + m_numCV + " (size=" + fold[0].size() + ")...");
       
        Classifier foldClassifier = m_trainer.train(fold[0]);
        Trial t1 = new Trial(foldClassifier, fold[0]);
        Trial t2 = new Trial(foldClassifier, fold[1]);

        logger.info("Within-fold accuracy = " + t1.getAccuracy());
        logger.info("Out-of-fold accuracy = " + t2.getAccuracy());

        /*for (int x = 0; x < t2.size(); x++) {
          logger.info("xxx pred:" + t2.getClassification(x).getLabeling().getBestLabel() + " true:" + t2.getClassification(x).getInstance().getLabeling());
        }*/
       
 
View Full Code Here

    System.err.println("Created " + trainList.size() + " instances.");
    Classifier me = new MaxEntTrainer().train(trainList);
    ClassifyingNeighborEvaluator eval =
      new ClassifyingNeighborEvaluator(me, "YES");
                                          
    Trial trial = new Trial(me, trainList);
    System.err.println(new ConfusionMatrix(trial));
    InfoGain ig = new InfoGain(trainList);
    ig.print();

//     Clusterer clusterer = new GreedyAgglomerative(training.getInstances().getPipe(),
View Full Code Here

    this(t, DEFAULT_NUM_BUCKETS, title, "unnamed");
  }
 
  public AccuracyCoverage(Classifier C, InstanceList ilist, String title)
  {
    this(new Trial(C, ilist), DEFAULT_NUM_BUCKETS, title, "unnamed");
  }
View Full Code Here

    this(new Trial(C, ilist), DEFAULT_NUM_BUCKETS, title, "unnamed");
  }
 
  public AccuracyCoverage(Classifier C, InstanceList ilist, int numBuckets, String title)
  {
    this(new Trial(C, ilist), numBuckets, title, "unnamed");
  }
View Full Code Here

          + " training instances");
      Classifier classifier = new MaxEntTrainer().train(trainingInstances);
      logger.info("InfoGain:\n");
      new InfoGain(trainingInstances).printByRank(System.out);
      logger.info("pairwise training accuracy="
          + new Trial(classifier, trainingInstances).getAccuracy());
      NeighborEvaluator neval = new PairwiseEvaluator(classifier, "YES",
          new PairwiseEvaluator.Average(), true);       
      clusterer = new GreedyAgglomerativeByDensity(
          training.get(0).getInstances().getPipe(), neval, 0.5, false,
          random);
View Full Code Here

TOP

Related Classes of cc.mallet.classify.Trial

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.