Package com.clearnlp.component.evaluation

Examples of com.clearnlp.component.evaluation.AbstractEval


  {
    boolean prepareBootstrap = bootstrapScore > 0;
    List<String> currOutput, bestOutput = null;
    FloatArrayList bestWeights = null;
    double currScore, bestScore = 0;
    AbstractEval eval;
    int iter;
   
    for (iter=1; true; iter++)
    {
      algorithm.train(model);
      currOutput = process(developFiles, reader, component, null, flag, -1);
     
      eval = component.getEval();
      currScore = eval.getAccuracies()[0];
      LOG.info(String.format("%2d: %s\n", iter, eval.toString()));
      eval.clear();
     
      if (bestScore < currScore)
      {
        bestWeights = model.cloneWeights();
        bestScore   = currScore;
View Full Code Here


  protected ObjectDoublePair<List<String>> developBatch(String[] developFiles, JointReader reader, AbstractOnlineStatisticalComponent<? extends AbstractState> component, StringModelAD model, AbstractAlgorithm algorithm, byte flag) throws Exception
  {
    algorithm.train(model);
    List<String> output = process(developFiles, reader, component, null, flag, -1);
   
    AbstractEval eval = component.getEval();
    double score = eval.getAccuracies()[0];
    LOG.info(String.format("%s\n", eval.toString()));
    eval.clear();
   
    return new ObjectDoublePair<List<String>>(output, score);
  }
View Full Code Here

    s_model.build(f_xml.getLabelCutoff(0), f_xml.getFeatureCutoff(0));
    s_model.printInfo(log);
   
    int[] indices = UTArray.range(s_model.getInstanceSize());
    Random rand = new Random(randomSeed);
    AbstractEval eval = new POSEval();
    double prevScore, currScore = 0;
    FloatArrayList prevWeights;
    String[] goldLabels;
    int iter = 1;
   
    do
    {
      prevScore   = currScore;
      prevWeights = s_model.cloneWeights();
     
      UTArray.shuffle(rand, indices);
      algorithm.updateWeights(s_model, indices);
     
      for (DEPTree tree : devTrees)
      {
        AbstractState state = process(tree, FLAG_DEVELOP, null);
        goldLabels = (String[])state.getGoldLabels();
        eval.countAccuracy(tree, goldLabels);
        tree.setPOSTags((String[])goldLabels);
      }
     
      System.out.printf("%2d: %s\n", iter++, eval.toString());
      currScore = eval.getAccuracies()[0];
      eval.clear();
    }
    while (prevScore < currScore);
   
    s_model.setWeights(prevWeights);
  }
View Full Code Here

TOP

Related Classes of com.clearnlp.component.evaluation.AbstractEval

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.