Package cc.mallet.fst.semi_supervised

Examples of cc.mallet.fst.semi_supervised.CRFOptimizableByGE


      optLikelihood = new ThreadedOptimizable(likelihood,trainingSet,crf.getParameters().getNumFactors(),
        new CRFCacheStaleIndicator(crf));
      likelihood.setGaussianPriorVariance(gpv);
    }

    CRFOptimizableByGE ge = new CRFOptimizableByGE(crf,constraints,unlabeledSet,map,numThreads,geWeight);
    // turn off the prior... it already appears above!
    ge.setGaussianPriorVariance(Double.POSITIVE_INFINITY);

    CRFOptimizableByGradientValues opt =
      new CRFOptimizableByGradientValues(crf,new Optimizable.ByGradientValue[] { optLikelihood, ge });
   
    LimitedMemoryBFGS optimizer = new LimitedMemoryBFGS(opt);

    try {
      converged = optimizer.optimize(numIterations);
    }
    catch (Exception e) {
      e.printStackTrace();
    }
   
    optimizer.reset();
    try {
      converged = optimizer.optimize(numIterations);
    }
    catch (Exception e) {
      e.printStackTrace();
    }
   
    if (numThreads > 1) {
      ((ThreadedOptimizable)optLikelihood).shutdown();
      ge.shutdown();
    }
   
    return converged;
  }
View Full Code Here

TOP

Related Classes of cc.mallet.fst.semi_supervised.CRFOptimizableByGE

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.