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)