int prevLabelIndex = 0; // This will put extra error instances in this cluster
for (int j = 0; j < trueOutput.size(); j++) {
Label label = (Label) ((LabelSequence)trueOutput).getLabelAtPosition(j);
assert (label != null);
//System.out.println ("Instance="+i+" position="+j+" fv="+lattice.getLabelingAtPosition(j).toString(true));
LabelVector latticeLabeling = lattice.getLabelingAtPosition(j);
double trueLabelProb = latticeLabeling.value(label.getIndex());
int labelIndex = latticeLabeling.getBestIndex();
//System.out.println ("position="+j+" trueLabelProb="+trueLabelProb);
if (trueLabelProb < trueLabelProbThreshold) {
logger.info ("Adding error: instance="+i+" position="+j+" prtrue="+trueLabelProb+
(label == latticeLabeling.getBestLabel() ? " " : " *")+
" truelabel="+label+
" predlabel="+latticeLabeling.getBestLabel()+
" fv="+((FeatureVector)input.get(j)).toString(true));
errorInstances.add (input.get(j), label, null, null);
errorLabelVectors.add (latticeLabeling);
clusteredErrorInstances[prevLabelIndex][labelIndex].add (input.get(j), label, null, null);
clusteredErrorLabelVectors[prevLabelIndex][labelIndex].add (latticeLabeling);