@Test
public void testPredictTransitionsSideways1()
{
final LearnerGraph graph = FsmParser.buildLearnerGraph("A-a->B-b->C / B-u-#D / A-c->E-u->F / E-c->G","testUpdateMarkovSideways3",config, converter);
MarkovModel mSideways = new MarkovModel(2,false,true), mForward = new MarkovModel(2,true,true);
new MarkovClassifier(mSideways,graph).updateMarkov(true);
Assert.assertEquals(9,mSideways.predictionsMatrix.size());Assert.assertTrue(mForward.predictionsMatrix.isEmpty());
List<List<Label>> interestingPaths = new LinkedList<List<Label>>();
// nothing in Markov matrix hence no predictions.
Assert.assertTrue(new MarkovClassifier(mForward,graph).predictTransitionsFromState(graph.findVertex("B"),null,2,interestingPaths).isEmpty());
Assert.assertEquals(1,interestingPaths.size());Assert.assertEquals(Arrays.asList(new Label[]{lblA}),interestingPaths.get(0));
interestingPaths.clear();
Map<Label, MarkovOutcome> outcome1 = new MarkovClassifier(mSideways,graph).predictTransitionsFromState(graph.findVertex("B"),null,2,interestingPaths);
Assert.assertEquals(1,interestingPaths.size());Assert.assertEquals(Arrays.asList(new Label[]{lblB}),interestingPaths.get(0));
Assert.assertEquals(2,outcome1.size());
Assert.assertEquals(MarkovOutcome.negative,outcome1.get(lblU));Assert.assertEquals(MarkovOutcome.positive,outcome1.get(lblB));
interestingPaths.clear();
outcome1 = new MarkovClassifier(mSideways,graph).predictTransitionsFromState(graph.findVertex("E"),null,2,interestingPaths);
Assert.assertEquals(2,interestingPaths.size());Assert.assertEquals(Arrays.asList(new Label[]{lblC}),interestingPaths.get(0));Assert.assertEquals(Arrays.asList(new Label[]{lblU}),interestingPaths.get(1));
Assert.assertEquals(3,outcome1.size());
Assert.assertEquals(MarkovOutcome.positive,outcome1.get(lblU));Assert.assertEquals(MarkovOutcome.positive,outcome1.get(lblC));Assert.assertEquals(MarkovOutcome.positive,outcome1.get(lblA));
}