Package cc.mallet.optimize

Examples of cc.mallet.optimize.LimitedMemoryBFGS.optimize()


//    boolean continueTraining = true;
    boolean converged = false;
    logger.info ("CRF about to train with "+numIterations+" iterations");
    for (i = 0; i < numIterations; i++) {
      try {
        converged = maximizer.optimize (1);
        logger.info ("CRF finished one iteration of maximizer, i="+i);
        runEvaluators();
      } catch (IllegalArgumentException e) {
        e.printStackTrace();
        logger.info ("Catching exception; saying converged.");
View Full Code Here


  //  maximizer.optimize (); // XXX given the loop below, this seems wrong.
     boolean converged;

     for (int i = 0; i < numIterations; i++) {
      try {
        converged = maximizer.optimize (1);
      } catch (IllegalArgumentException e) {
        e.printStackTrace();
        logger.info ("Catching exception; saying converged.");
        converged = true;
      }
View Full Code Here

    logger.fine ("trainingSet.size() = "+trainingSet.size());
    mt = new MaximizableTrainer (trainingSet, (MCMaxEnt)initialClassifier);
    Optimizer maximizer = new LimitedMemoryBFGS(mt);
    // CPAL - change the tolerance for large vocab experiments
    ((LimitedMemoryBFGS)maximizer).setTolerance(.00001);    // std is .0001;
    maximizer.optimize (); // XXX given the loop below, this seems wrong.

    logger.info("MCMaxEnt ngetValueCalls:"+getValueCalls()+"\nMCMaxEnt ngetValueGradientCalls:"+getValueGradientCalls());
//    boolean converged;
//
//     for (int i = 0; i < numIterations; i++) {
View Full Code Here

    LimitedMemoryBFGS optimizer = new LimitedMemoryBFGS(optimizable);

    // Optimize once
    try {
      optimizer.optimize();
    } catch (OptimizationException e) {
      // step size too small
    }

    // Restart with a fresh initialization to improve likelihood
View Full Code Here

      // step size too small
    }

    // Restart with a fresh initialization to improve likelihood
    try {
      optimizer.optimize();
    } catch (OptimizationException e) {
      // step size too small
    }
        dmrParameters = optimizable.getClassifier();
View Full Code Here

      CRFOptimizableByKL optP = new CRFOptimizableByKL(crf, train, model, opt.getCachedDots(), numThreads, 1);
      optP.setGaussianPriorVariance(pGpv);
      LimitedMemoryBFGS bfgsP = new LimitedMemoryBFGS(optP);
     
      try {
        bfgsP.optimize(maxIterPerStep);
      } catch (Exception e) {
        e.printStackTrace();
      }
      optP.shutdown();
     
View Full Code Here

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

    try {
      converged = optimizer.optimize(numIterations);
    }
    catch (Exception e) {
      e.printStackTrace();
    }
   
View Full Code Here

      e.printStackTrace();
    }
   
    optimizer.reset();
    try {
      converged = optimizer.optimize(numIterations);
    }
    catch (Exception e) {
      e.printStackTrace();
    }
   
View Full Code Here

    // train supervised
    MaxEntOptimizableByLabelDistribution opt = new  MaxEntOptimizableByLabelDistribution(dataLabeled,p);
    opt.setGaussianPriorVariance(pGPV);

    LimitedMemoryBFGS bfgs = new LimitedMemoryBFGS(opt);
    try { bfgs.optimize(); } catch (Exception e) { e.printStackTrace(); }
    bfgs.reset();
    try { bfgs.optimize(); } catch (Exception e) { e.printStackTrace(); }
   
    double value = 0;
    for (MaxEntPRConstraint constraint : q.getConstraintFeatures()) {
View Full Code Here

    opt.setGaussianPriorVariance(pGPV);

    LimitedMemoryBFGS bfgs = new LimitedMemoryBFGS(opt);
    try { bfgs.optimize(); } catch (Exception e) { e.printStackTrace(); }
    bfgs.reset();
    try { bfgs.optimize(); } catch (Exception e) { e.printStackTrace(); }
   
    double value = 0;
    for (MaxEntPRConstraint constraint : q.getConstraintFeatures()) {
      // plus sign because this returns negative values
      value += constraint.getCompleteValueContribution();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.