当前位置: 首页>>代码示例>>Java>>正文


Java ACRFEvaluator类代码示例

本文整理汇总了Java中cc.mallet.grmm.learning.ACRFEvaluator的典型用法代码示例。如果您正苦于以下问题:Java ACRFEvaluator类的具体用法?Java ACRFEvaluator怎么用?Java ACRFEvaluator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ACRFEvaluator类属于cc.mallet.grmm.learning包,在下文中一共展示了ACRFEvaluator类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: incrementalTrain

import cc.mallet.grmm.learning.ACRFEvaluator; //导入依赖的package包/类
public boolean incrementalTrain (ACRF acrf,
                                 InstanceList training,
                                 InstanceList validation,
                                 InstanceList testing,
                                 ACRFEvaluator eval,
                                 int numIter)
{
  long stime = new Date ().getTime ();
  for (int i = 0; i < SIZE.length; i++) {
    InstanceList subset = training.split (new double[]
            {SIZE[i], 1 - SIZE[i]})[0];
    logger.info ("Training on subset of size " + subset.size ());
    Optimizable.ByGradientValue subset_macrf = createOptimizable (acrf, subset);
    train (acrf, training, validation, null, eval,
            SUBSET_ITER, subset_macrf);
    logger.info ("Subset training " + i + " finished...");
  }
  long etime = new Date ().getTime ();
  logger.info ("All subset training finished.  Time = " + (etime - stime) + " ms.");
  return train (acrf, training, validation, testing, eval, numIter);
}
 
开发者ID:mimno,项目名称:GRMM,代码行数:22,代码来源:DefaultAcrfTrainer.java

示例2: callEvaluator

import cc.mallet.grmm.learning.ACRFEvaluator; //导入依赖的package包/类
/**
 * @return true means stop, false means keep going (opposite of evaluators... ugh!)
 */
protected boolean callEvaluator (ACRF acrf, InstanceList trainingList, InstanceList validationList,
                               InstanceList testSet, int iter, ACRFEvaluator eval)
{
  if (eval == null) return false;  // If no evaluator specified, keep going blindly

  eval.setOutputPrefix (outputPrefix);

  // don't cache test set
  boolean wasCached = acrf.isCacheUnrolledGraphs ();
  acrf.setCacheUnrolledGraphs (false);

  Timing timing = new Timing ();

  if (!eval.evaluate (acrf, iter+1, trainingList, validationList, testSet)) {
    logger.info ("ACRF trainer: evaluator returned false. Quitting.");
    timing.tick ("Evaluation time (iteration "+iter+")");
    return true;
  }

  timing.tick ("Evaluation time (iteration "+iter+")");

  // set test set caching back to normal
  acrf.setCacheUnrolledGraphs (wasCached);
  return false;
}
 
开发者ID:mimno,项目名称:GRMM,代码行数:29,代码来源:DefaultAcrfTrainer.java

示例3: someUnsupportedTrain

import cc.mallet.grmm.learning.ACRFEvaluator; //导入依赖的package包/类
public boolean someUnsupportedTrain (ACRF acrf,
                      InstanceList trainingList,
                      InstanceList validationList,
                      InstanceList testSet,
                      ACRFEvaluator eval,
                      int numIter)
{

  Optimizable.ByGradientValue macrf = createOptimizable (acrf, trainingList);
  train (acrf, trainingList, validationList, testSet, eval, 5, macrf);
  ACRF.Template[] tmpls = acrf.getTemplates ();
  for (int ti = 0; ti < tmpls.length; ti++)
    tmpls[ti].addSomeUnsupportedWeights (trainingList);
  logger.info ("Some unsupporetd weights initialized.  Training...");
  return train (acrf, trainingList, validationList, testSet, eval, numIter, macrf);
}
 
开发者ID:mimno,项目名称:GRMM,代码行数:17,代码来源:DefaultAcrfTrainer.java

示例4: train

import cc.mallet.grmm.learning.ACRFEvaluator; //导入依赖的package包/类
public boolean train (ACRF acrf,
                      InstanceList trainingList,
                      InstanceList validationList,
                      InstanceList testSet,
                      ACRFEvaluator eval,
                      int numIter)
{
  Optimizable.ByGradientValue macrf = createOptimizable (acrf, trainingList);
  return train (acrf, trainingList, validationList, testSet,
          eval, numIter, macrf);
}
 
开发者ID:mimno,项目名称:GRMM,代码行数:12,代码来源:DefaultAcrfTrainer.java

示例5: test

import cc.mallet.grmm.learning.ACRFEvaluator; //导入依赖的package包/类
public void test (ACRF acrf, InstanceList testing, ACRFEvaluator[] evals)
{
  List pred = acrf.getBestLabels (testing);
  for (int i = 0; i < evals.length; i++) {
    evals[i].setOutputPrefix (outputPrefix);
    evals[i].test (testing, pred, "Testing");
  }
}
 
开发者ID:mimno,项目名称:GRMM,代码行数:9,代码来源:DefaultAcrfTrainer.java

示例6: evaluate

import cc.mallet.grmm.learning.ACRFEvaluator; //导入依赖的package包/类
public boolean evaluate (ACRF acrf, int iter, InstanceList training, InstanceList validation, InstanceList testing)
{
  boolean ret = true;
  for (Iterator it = evals.iterator (); it.hasNext ();) {
    ACRFEvaluator evaluator = (ACRFEvaluator) it.next ();
    // Return false (i.e., stop training) if any sub-evaluator does.
    ret = ret && evaluator.evaluate (acrf, iter, training, validation, testing);
  }
  return ret;
}
 
开发者ID:mimno,项目名称:GRMM,代码行数:11,代码来源:AcrfSerialEvaluator.java

示例7: test

import cc.mallet.grmm.learning.ACRFEvaluator; //导入依赖的package包/类
public void test (InstanceList gold, List returned, String description)
{
  for (Iterator it = evals.iterator (); it.hasNext ();) {
    ACRFEvaluator eval =  (ACRFEvaluator) it.next ();
    eval.test (gold, returned, description);
  }
}
 
开发者ID:mimno,项目名称:GRMM,代码行数:8,代码来源:AcrfSerialEvaluator.java


注:本文中的cc.mallet.grmm.learning.ACRFEvaluator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。