Examples of trainIncremental()


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

     testing.addThruPipe (new ArrayIterator (data1));

     CRF crf = new CRF (pipe, null);
     crf.addFullyConnectedStatesForLabels ();
     CRFTrainerByLabelLikelihood crft = new CRFTrainerByLabelLikelihood (crf);
     crft.trainIncremental (training);

     CRFExtractor extor = TestLatticeViewer.hackCrfExtor (crf);
     Extraction extraction = extor.extract (new ArrayIterator (data1));

     if (!outputDir.exists ()) outputDir.mkdir ();
View Full Code Here

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

    testing.addThruPipe (new ArrayIterator (data1));

    CRF crf = new CRF (pipe, null);
    crf.addFullyConnectedStatesForLabels ();
    CRFTrainerByLabelLikelihood crft = new CRFTrainerByLabelLikelihood (crf);
    crft.trainIncremental (training);

    CRFExtractor extor = hackCrfExtor (crf);
    Extraction extration = extor.extract (new ArrayIterator (data1));

    PrintStream out = new PrintStream (new FileOutputStream (htmlFile));
View Full Code Here

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

      System.out.println("Training Accuracy before training = "
          + crf.averageTokenAccuracy(lists[0]));
      System.out.println("Testing  Accuracy before training = "
          + crf.averageTokenAccuracy(lists[1]));
      System.out.println("Training...");
      crft.trainIncremental(lists[0]);
      System.out.println("Training Accuracy after training = "
          + crf.averageTokenAccuracy(lists[0]));
      System.out.println("Testing  Accuracy after training = "
          + crf.averageTokenAccuracy(lists[1]));
      System.out.println("Training results:");
View Full Code Here

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

          + crf.averageTokenAccuracy(lists[0]));
      System.out.println("Testing  Accuracy before training = "
          + crf.averageTokenAccuracy(lists[1]));
      savedCRF = crf;
      System.out.println("Training serialized crf.");
      crft.trainIncremental(lists[0]);
      double preTrainAcc = crf.averageTokenAccuracy(lists[0]);
      double preTestAcc = crf.averageTokenAccuracy(lists[1]);
      System.out.println("Training Accuracy after training = "
          + preTrainAcc);
      System.out.println("Testing  Accuracy after training = "
View Full Code Here

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

    CRF crf1 = new CRF(p.getDataAlphabet(), p.getTargetAlphabet());
    crf1.addFullyConnectedStatesForLabels();
    CRFTrainerByLabelLikelihood crft1 = new CRFTrainerByLabelLikelihood(
        crf1);
    crft1.trainIncremental(instances);

    CRF crf2 = new CRF(p.getDataAlphabet(), p.getTargetAlphabet());
    crf2.addFullyConnectedStatesForLabels();
    // Freeze some weights, before training
    for (int i = 0; i < crf2.getWeights().length; i += 2)
View Full Code Here

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

    // Freeze some weights, before training
    for (int i = 0; i < crf2.getWeights().length; i += 2)
      crf2.freezeWeights(i);
    CRFTrainerByLabelLikelihood crft2 = new CRFTrainerByLabelLikelihood(
        crf2);
    crft2.trainIncremental(instances);

    SparseVector[] w = crf2.getWeights();
    double[] b = crf2.getDefaultWeights();
    for (int i = 0; i < w.length; i += 2) {
      assertEquals(0.0, b[i], 1e-10);
View Full Code Here

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

    CRF crf = new CRF(p.getDataAlphabet(), p.getTargetAlphabet());
    crf.addFullyConnectedStatesForLabels();
    CRFTrainerByLabelLikelihood crft = new CRFTrainerByLabelLikelihood(crf);
    crft.setUseSparseWeights(true);

    crft.trainIncremental(lists[0]);

    TokenAccuracyEvaluator eval = new TokenAccuracyEvaluator(lists,
        new String[] { "Train", "Test" });
    eval.evaluateInstanceList(crft, lists[1], "Test");
View Full Code Here

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

    // 12/2007

    CRF crf = new CRF(p, null);
    crf.addFullyConnectedStatesForLabels();
    CRFTrainerByLabelLikelihood crft = new CRFTrainerByLabelLikelihood(crf);
    crft.trainIncremental(training);

    // Check that the notstart state is used at test time
    Sequence input = (Sequence) training.get(0).getData();
    Sequence output = new MaxLatticeDefault(crf, input)
        .bestOutputSequence();
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.