Package cc.mallet.fst

Examples of cc.mallet.fst.CRFTrainerByStochasticGradient


    instances.addThruPipe(new ArrayIterator(data));
    InstanceList[] lists = instances.split(new double[] { .5, .5 });
    CRF crf = new CRF(p, p2);
    crf.addFullyConnectedStatesForLabels();
    crf.setWeightsDimensionAsIn(lists[0], false);
    CRFTrainerByStochasticGradient crft = new CRFTrainerByStochasticGradient(
        crf, 0.0001);
    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...");
    // either fixed learning rate or selected on a sample
    crft.setLearningRateByLikelihood(lists[0]);
    // crft.setLearningRate(0.01);
    crft.train(lists[0], 100);
    crf.print();
    System.out.println("Training Accuracy after training = "
        + crf.averageTokenAccuracy(lists[0]));
    System.out.println("Testing  Accuracy after training = "
        + crf.averageTokenAccuracy(lists[1]));
View Full Code Here


    instances.addThruPipe(new ArrayIterator(data));
    InstanceList[] lists = instances.split(new double[] { .5, .5 });
    CRF crf = new CRF(p, p2);
    crf.addFullyConnectedStatesForLabels();
    crf.setWeightsDimensionAsIn(lists[0], false);
    CRFTrainerByStochasticGradient crft = new CRFTrainerByStochasticGradient(
        crf, 0.0001);
    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...");
    // either fixed learning rate or selected on a sample
    crft.setLearningRateByLikelihood(lists[0]);
    // crft.setLearningRate(0.01);
    crft.train(lists[0], 100);
    crf.print();
    System.out.println("Training Accuracy after training = "
        + crf.averageTokenAccuracy(lists[0]));
    System.out.println("Testing  Accuracy after training = "
        + crf.averageTokenAccuracy(lists[1]));
View Full Code Here

TOP

Related Classes of cc.mallet.fst.CRFTrainerByStochasticGradient

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.