Package cc.mallet.fst

Examples of cc.mallet.fst.SumLatticeDefault


        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);
    for (int ip = 0; ip < lattice.length() - 1; ip++) {
      for (int i = 0; i < crf1.numStates(); i++) {
        Transducer.State state = crf1.getState(i);
        Transducer.TransitionIterator it = state.transitionIterator(
            input, ip);
        double gamma = lattice.getGammaProbability(ip, state);
        double xiSum = 0;
        while (it.hasNext()) {
          Transducer.State dest = it.nextState();
          double xi = lattice.getXiProbability(ip, state, dest);
          xiSum += xi;
        }
        assertEquals(gamma, xiSum, 1e-5);
      }
    }
View Full Code Here


      for (int ii = start; ii < end; ii++) {
        if (!constraintBits.get(ii)) {
          continue;
        }
        FeatureVectorSequence fvs = (FeatureVectorSequence)data.get(ii).getData();
        lattices.put(ii, new SumLatticeDefault(crf,fvs,true));
      }
      return null;
    }
View Full Code Here

    expectations.zero();

    // now, update the expectations due to each instance for entropy reg.
    for (int ii = 0; ii < data.size(); ii++) {
      FeatureVectorSequence input = (FeatureVectorSequence) data.get(ii).getData();
      SumLattice lattice = new SumLatticeDefault(crf,input, true);

      // udpate the expectations
      EntropyLattice entropyLattice = new EntropyLattice(
          input, lattice.getGammas(), lattice.getXis(), crf,
          incrementor, scalingFactor);
      cachedValue += entropyLattice.getEntropy();
    }
  }
View Full Code Here

TOP

Related Classes of cc.mallet.fst.SumLatticeDefault

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.