Package cc.mallet.fst

Examples of cc.mallet.fst.CRFTrainerByLabelLikelihood.train()


    CRF crf = new CRF (pipe, null);
    crf.addFullyConnectedStatesForLabels ();
    CRFTrainerByLabelLikelihood crft = new CRFTrainerByLabelLikelihood (crf);
    TokenAccuracyEvaluator eval = new TokenAccuracyEvaluator (new InstanceList[] {training, testing}, new String[] {"Training", "Testing"});
    for (int i = 0; i < 5; i++) {
      crft.train (training, 1);
      eval.evaluate(crft);
    }

    CRFExtractor extor = hackCrfExtor (crf);
    Extraction e1 = extor.extract (new ArrayIterator (data1));
View Full Code Here


      // train supervised
      if (numThreads == 1) {
        CRFTrainerByLabelLikelihood trainer = new CRFTrainerByLabelLikelihood(crf);
        trainer.setAddNoFactors(true);
        trainer.setGaussianPriorVariance(gpv);
        trainer.train(trainingSet,supIterations);
      }
      else {
        CRFTrainerByThreadedLabelLikelihood trainer = new CRFTrainerByThreadedLabelLikelihood(crf,numThreads);
        trainer.setAddNoFactors(true);
        trainer.setGaussianPriorVariance(gpv);
View Full Code Here

      }
      else {
        CRFTrainerByThreadedLabelLikelihood trainer = new CRFTrainerByThreadedLabelLikelihood(crf,numThreads);
        trainer.setAddNoFactors(true);
        trainer.setGaussianPriorVariance(gpv);
        trainer.train(trainingSet,supIterations);
        trainer.shutdown();
      }
      runEvaluators();
    }
   
View Full Code Here

    crf1.addOrderNStates(instances, new int[] { 0 }, null, "start", null,
        null, true);
    CRFTrainerByLabelLikelihood crft1 = new CRFTrainerByLabelLikelihood(
        crf1);
    crft1.setUseSparseWeights(false);
    crft1.train(instances, 1); // Set weights dimension
    int nParams1 = crft1.getOptimizableCRF(instances).getNumParameters();

    CRF crf2 = new CRF(p, null);
    crf2.addOrderNStates(instances, new int[] { 0, 1 }, new boolean[] {
        false, true }, "start", null, null, true);
View Full Code Here

    crf2.addOrderNStates(instances, new int[] { 0, 1 }, new boolean[] {
        false, true }, "start", null, null, true);
    CRFTrainerByLabelLikelihood crft2 = new CRFTrainerByLabelLikelihood(
        crf2);
    crft2.setUseSparseWeights(false);
    crft2.train(instances, 1); // Set weights dimension
    int nParams2 = crft2.getOptimizableCRF(instances).getNumParameters();

    assertEquals(nParams2, nParams1 + 4);

  }
View Full Code Here

    CRF crf1 = new CRF(p, null);
    crf1.addFullyConnectedStatesForLabels();
    CRFTrainerByLabelLikelihood crft1 = new CRFTrainerByLabelLikelihood(
        crf1);
    crft1.train(instances, 10); // Let's get some parameters

    Instance inst = instances.get(0);
    Sequence input = (Sequence) inst.getData();
    SumLatticeDefault lattice = new SumLatticeDefault(crf1, input,
        (Sequence) inst.getTarget(), null, true);
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.