Package cc.mallet.pipe.iterator

Examples of cc.mallet.pipe.iterator.ArrayIterator


  public void doTestSpacePrediction(boolean testValueAndGradient) {
    Pipe p = makeSpacePredictionPipe();
    Pipe p2 = new TestCRF2String();

    InstanceList instances = new InstanceList(p);
    instances.addThruPipe(new ArrayIterator(data));
    InstanceList[] lists = instances.split(new Random(1), new double[] {
        .5, .5 });
    CRF crf = new CRF(p, p2);
    crf.addFullyConnectedStatesForLabels();
    CRFTrainerByLabelLikelihood crft = new CRFTrainerByLabelLikelihood(crf);
View Full Code Here


    Pipe p = makeSpacePredictionPipe();

    CRF savedCRF;
    File f = new File("TestObject.obj");
    InstanceList instances = new InstanceList(p);
    instances.addThruPipe(new ArrayIterator(data));
    InstanceList[] lists = instances.split(new double[] { .5, .5 });
    CRF crf = new CRF(p.getDataAlphabet(), p.getTargetAlphabet());
    crf.addFullyConnectedStatesForLabels();
    CRFTrainerByLabelLikelihood crft = new CRFTrainerByLabelLikelihood(crf);
    crft.setUseSparseWeights(useSparseWeights);
View Full Code Here

  public void testAddOrderNStates() {
    Pipe p = makeSpacePredictionPipe();

    InstanceList instances = new InstanceList(p);
    instances.addThruPipe(new ArrayIterator(data));
    InstanceList[] lists = instances.split(new java.util.Random(678),
        new double[] { .5, .5 });

    // Compare 3 CRFs trained with addOrderNStates, and make sure
    // that having more features leads to a higher likelihood
View Full Code Here

  public void testFrozenWeights() {
    Pipe p = makeSpacePredictionPipe();

    InstanceList instances = new InstanceList(p);
    instances.addThruPipe(new ArrayIterator(data));

    CRF crf1 = new CRF(p.getDataAlphabet(), p.getTargetAlphabet());
    crf1.addFullyConnectedStatesForLabels();
    CRFTrainerByLabelLikelihood crft1 = new CRFTrainerByLabelLikelihood(
        crf1);
View Full Code Here

  public void testTrainStochasticGradient() {
    Pipe p = makeSpacePredictionPipe();
    Pipe p2 = new TestCRF2String();

    InstanceList instances = new InstanceList(p);
    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(
View Full Code Here

    Pipe p = makeSpacePredictionPipe();
    Pipe p2 = new TestCRF2String();

    // first do normal training for getting weights
    InstanceList instances = new InstanceList(p);
    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(
View Full Code Here

  public void testTokenAccuracy() {
    Pipe p = makeSpacePredictionPipe();

    InstanceList instances = new InstanceList(p);
    instances.addThruPipe(new ArrayIterator(data));
    InstanceList[] lists = instances.split(new Random(777), new double[] {
        .5, .5 });

    CRF crf = new CRF(p.getDataAlphabet(), p.getTargetAlphabet());
    crf.addFullyConnectedStatesForLabels();
View Full Code Here

        new TestCRFTokenSequenceRemoveSpaces(),
        new TokenSequence2FeatureVectorSequence(),
        new PrintInputAndTarget(), });
    InstanceList one = new InstanceList(p);
    String[] data = new String[] { "ABCDE", };
    one.addThruPipe(new ArrayIterator(data));
    CRF crf = new CRF(p, null);
    crf.addFullyConnectedStatesForThreeQuarterLabels(one);
    CRFTrainerByLabelLikelihood crft = new CRFTrainerByLabelLikelihood(crf);
    crf.setWeightsDimensionAsIn(one, false);
    Optimizable mcrf = crft.getOptimizableCRF(one);
View Full Code Here

        new TestCRFTokenSequenceRemoveSpaces(),
        new TokenSequence2FeatureVectorSequence(),
        new PrintInputAndTarget(), });
    InstanceList one = new InstanceList(p);
    String[] data = new String[] { "ABCDE", };
    one.addThruPipe(new ArrayIterator(data));
    CRF crf = new CRF(p, null);
    crf.addFullyConnectedStatesForLabels();
    CRFTrainerByLabelLikelihood crft = new CRFTrainerByLabelLikelihood(crf);
    crf.setWeightsDimensionAsIn(one, false);
    Optimizable.ByGradientValue mcrf = crft.getOptimizableCRF(one);
View Full Code Here

  // Tests that setWeightsDimensionDensely respects featureSelections
  public void testDenseFeatureSelection() {
    Pipe p = makeSpacePredictionPipe();

    InstanceList instances = new InstanceList(p);
    instances.addThruPipe(new ArrayIterator(data));

    // Test that dense observations wights aren't added for
    // "default-feature" edges.
    CRF crf1 = new CRF(p, null);
    crf1.addOrderNStates(instances, new int[] { 0 }, null, "start", null,
View Full Code Here

TOP

Related Classes of cc.mallet.pipe.iterator.ArrayIterator

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.