Package cc.mallet.fst.MEMM

Examples of cc.mallet.fst.MEMM.TransitionIterator


        for (int j = 0; j < s.trainingSet.size(); j++) {
          Instance instance = s.trainingSet.get (j);
          double instWeight = s.trainingSet.getInstanceWeight (j);
          FeatureVector fv = (FeatureVector) instance.getData ();
          String labelString = (String) instance.getTarget ();
          TransitionIterator iter = new TransitionIterator (s, fv, gatherConstraints?labelString:null, memm);
          while (iter.hasNext ()) {
            // gsc
            iter.nextState(); // advance the iterator
//            State destination = (MEMM.State) iter.nextState();  // Just to advance the iterator
            double weight = iter.getWeight();
            factorIncrementor.incrementTransition(iter, Math.exp(weight) * instWeight);
            //iter.incrementCount (Math.exp(weight) * instWeight);
            if (!gatherConstraints && iter.getOutput() == labelString) {
              if (!Double.isInfinite (weight))
                labelLogProb += instWeight * weight; // xxx   ?????
              else {
                logger.warning ("State "+i+" transition "+j+" has infinite cost; skipping.");
                if (initializingInfiniteValues)
View Full Code Here

TOP

Related Classes of cc.mallet.fst.MEMM.TransitionIterator

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.