Examples of MarkovUniversalLearner


Examples of statechum.analysis.learning.MarkovUniversalLearner

  @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);
    MarkovUniversalLearner m = new MarkovUniversalLearner(2);
    m.predictTransitionsAndUpdateMarkov(graph,false,true);
    Assert.assertTrue(m.getMarkov(true).isEmpty());
    Assert.assertEquals(9,m.getMarkov(false).size());
   
    Configuration shallowCopy = graph.config.copy();shallowCopy.setLearnerCloneGraph(false);
    Map<Trace, MarkovOutcome> markovMatrix = m.getMarkov(false);
   
    List<List<Label>> interestingPaths = new LinkedList<List<Label>>();
    // nothing in Markov matrix hence no predictions.
    Assert.assertTrue(MarkovUniversalLearner.predictTransitionsFromState(m.getMarkov(true),graph,true,graph.findVertex("B"),graph.pathroutines.computeAlphabet(),null,2,interestingPaths).isEmpty());
    Assert.assertEquals(1,interestingPaths.size());Assert.assertEquals(Arrays.asList(new Label[]{lblB}),interestingPaths.get(0));
   
    interestingPaths.clear();
    Map<Label, MarkovOutcome> outcome1 = MarkovUniversalLearner.predictTransitionsFromState(markovMatrix,graph,false,graph.findVertex("B"),graph.pathroutines.computeAlphabet(),null,2,interestingPaths);
    Assert.assertEquals(1,interestingPaths.size());Assert.assertEquals(Arrays.asList(new Label[]{lblB}),interestingPaths.get(0));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.