Package cc.mallet.types

Examples of cc.mallet.types.InstanceList.split()


    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);
    if (testValueAndGradient) {
View Full Code Here


    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);
    if (testValueAndGradient) {
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

    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(
        crf, 0.0001);
View Full Code Here

    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(
        crf, 0.0001);
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();
    CRFTrainerByLabelLikelihood crft = new CRFTrainerByLabelLikelihood(crf);
View Full Code Here

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

    InstanceList instances = new InstanceList(p);
    instances.addThruPipe(new ArrayIterator(data));
    InstanceList[] lists = instances.split(new double[]{.5, .5});
    MEMM memm = new MEMM(p, p2);
    memm.addFullyConnectedStatesForLabels();
    memm.setWeightsDimensionAsIn(lists[0]);
   
    MEMMTrainer memmt = new MEMMTrainer (memm);
View Full Code Here

    MEMM 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});
    MEMM crf = new MEMM(p.getDataAlphabet(), p.getTargetAlphabet());
    crf.addFullyConnectedStatesForLabels();
    if (useSparseWeights)
      crf.setWeightsDimensionAsIn(lists[0]);
    else
View Full Code Here

  {
    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

    MEMM crf1 = new MEMM(p.getDataAlphabet(), p.getTargetAlphabet());
View Full Code Here

                Pattern.compile("^\\s*$"), true));
        } else
        {
          Random r = new Random (randomSeedOption.value);
          InstanceList[] trainingLists =
            trainingData.split(
                r, new double[] {trainingFractionOption.value,
                  1-trainingFractionOption.value});
          trainingData = trainingLists[0];
          testData = trainingLists[1];
        }
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.