Examples of predictTransitions()


Examples of statechum.analysis.learning.MarkovClassifier.predictTransitions()

    MarkovModel m = new MarkovModel(2,true,true,markovPTAUseMatrix);
    Set<List<Label>> plusStrings = buildSet(new String[][] { new String[]{"a","b"} },config,converter), minusStrings = buildSet(new String[][] { new String[]{"a","u"} },config,converter);
    m.createMarkovLearner(plusStrings, minusStrings,false);
    final LearnerGraph graph = FsmParser.buildLearnerGraph("A-a->B / T-b->T-u->T","testConstructExtendedGraph3a",config, converter);
    MarkovClassifier cl = new MarkovClassifier(m,graph);
    Map<CmpVertex, Map<Label, MarkovOutcome>> newTransitions = cl.predictTransitions();
    Assert.assertEquals(1,newTransitions.size());// not enough evidence to update, hence nothing should be recorded.

    Assert.assertSame(MarkovOutcome.negative, newTransitions.get(graph.findVertex("B")).get(lblU));
   
    Assert.assertSame(MarkovOutcome.positive, newTransitions.get(graph.findVertex("B")).get(lblB));
View Full Code Here

Examples of statechum.analysis.learning.MarkovClassifier.predictTransitions()

    MarkovModel m = new MarkovModel(2,true,true,markovPTAUseMatrix);
    Set<List<Label>> plusStrings = buildSet(new String[][] { new String[]{"a","b"},new String[]{"a","u"} },config,converter), minusStrings = buildSet(new String[][] { new String[]{"a","u"} },config,converter);
    m.createMarkovLearner(plusStrings, minusStrings,false);
    final LearnerGraph graph = FsmParser.buildLearnerGraph("A-a->B / T-b->T-u->T","testConstructExtendedGraph3a",config, converter);
    MarkovClassifier cl = new MarkovClassifier(m,graph);
    Map<CmpVertex, Map<Label, MarkovOutcome>> newTransitions = cl.predictTransitions();
    Assert.assertEquals(1,newTransitions.size());// not enough evidence to update, hence nothing should be recorded.

    Assert.assertFalse(newTransitions.get(graph.findVertex("B")).containsKey(lblU));// failure ignored
   
    Assert.assertSame(MarkovOutcome.positive, newTransitions.get(graph.findVertex("B")).get(lblB));
View Full Code Here

Examples of statechum.analysis.learning.MarkovClassifier.predictTransitions()

    MarkovModel m = new MarkovModel(2,true,true,markovPTAUseMatrix);// w below is to ensure that all elements of the alphabet are included in traces.
    Set<List<Label>> plusStrings = buildSet(new String[][] { new String[]{"a","b"},new String[]{"c","u"},new String[]{"w"} },config,converter), minusStrings = buildSet(new String[][] { new String[]{"a","u"} },config,converter);
    m.createMarkovLearner(plusStrings, minusStrings,false);
    final LearnerGraph graph = FsmParser.buildLearnerGraph("A-a->B / A-w->M-c->B / T-b->T-u->T","testConstructExtendedGraph5a",config, converter);// the purpose of the w-transition is to ensure transition c is taken into account in graph comparison
    MarkovClassifier cl = new MarkovClassifier(m,graph);
    Map<CmpVertex, Map<Label, MarkovOutcome>> newTransitions = cl.predictTransitions();
    Assert.assertEquals(1,newTransitions.size());

    Assert.assertEquals(1,newTransitions.get(graph.findVertex("B")).size());
   
    Assert.assertSame(MarkovOutcome.positive,newTransitions.get(graph.findVertex("B")).get(lblB));
View Full Code Here

Examples of statechum.analysis.learning.MarkovClassifier.predictTransitions()

    MarkovModel m = new MarkovModel(2,true,true,markovPTAUseMatrix);
    Set<List<Label>> plusStrings = buildSet(new String[][] { new String[]{"a","b"},new String[]{"c","u"} },config,converter), minusStrings = buildSet(new String[][] { new String[]{"a","u"} },config,converter);
    m.createMarkovLearner(plusStrings, minusStrings,false);
    final LearnerGraph graph = FsmParser.buildLearnerGraph("A-a->B / A-c->B / T-b->T-u->T","testConstructExtendedGraph6a",config, converter);
    MarkovClassifier cl = new MarkovClassifier(m,graph);
    Map<CmpVertex, Map<Label, MarkovOutcome>> newTransitions = cl.predictTransitions();
   
    Assert.assertEquals(1,newTransitions.size());

    Assert.assertEquals(1,newTransitions.get(graph.findVertex("B")).size());
   
View Full Code Here

Examples of statechum.analysis.learning.MarkovClassifier.predictTransitions()

    MarkovModel m = new MarkovModel(2,true,true,markovPTAUseMatrix);
    Set<List<Label>> plusStrings = buildSet(new String[][] { new String[]{"a","b"},new String[]{"c","u"} },config,converter), minusStrings = buildSet(new String[][] { new String[]{"a","u"} },config,converter);
    m.createMarkovLearner(plusStrings, minusStrings,false);
    final LearnerGraph graph = FsmParser.buildLearnerGraph("A-a->B / A-c->B-c->Z / T-b->T-u->T","testConstructExtendedGraph7a",config, converter);
    MarkovClassifier cl = new MarkovClassifier(m,graph);
    Map<CmpVertex, Map<Label, MarkovOutcome>> newTransitions = cl.predictTransitions();
   
    Assert.assertEquals(2,newTransitions.size());

    Assert.assertEquals(1,newTransitions.get(graph.findVertex("B")).size());
    Assert.assertEquals(1,newTransitions.get(graph.findVertex("Z")).size());
View Full Code Here

Examples of statechum.analysis.learning.MarkovUniversalLearner.predictTransitions()

    m.predictTransitionsAndUpdateMarkov(graph,false,true);
    Assert.assertTrue(m.getMarkov(true).isEmpty());
    Assert.assertEquals(9,m.getMarkov(false).size());
   
    final LearnerGraph graph2 = FsmParser.buildLearnerGraph("A-a->B / A-c->A","testCheckFanoutInconsistencySideways4",config, converter);
    Map<CmpVertex, Map<Label, MarkovOutcome>> predictions = m.predictTransitions(graph2,true);
    Assert.assertTrue(predictions.isEmpty());// empty Markov means no predictions.
  }
 
  @Test
  public void testPredictTransitionsFromStatesForward2a()
View Full Code Here

Examples of statechum.analysis.learning.MarkovUniversalLearner.predictTransitions()

    m.predictTransitionsAndUpdateMarkov(graph,true,true);
    Assert.assertEquals(4,m.getMarkov(true).size());
    Assert.assertTrue(m.getMarkov(false).isEmpty());
   
    final LearnerGraph graph2 = FsmParser.buildLearnerGraph("A-a->B / A-c->A/ T-u->T-b->T","testPredictTransitionsFromStatesForward2",config, converter);
    Map<CmpVertex, Map<Label, MarkovOutcome>> predictions = m.predictTransitions(graph2,true);
    Assert.assertEquals(2,predictions.size());Assert.assertEquals(2,predictions.get(graph2.findVertex("A")).size());Assert.assertEquals(2,predictions.get(graph2.findVertex("B")).size());
    Assert.assertEquals(MarkovOutcome.positive,predictions.get(graph2.findVertex("A")).get(lblU));// because c is looping in the A state
    Assert.assertEquals(MarkovOutcome.positive,predictions.get(graph2.findVertex("A")).get(lblC));
    Assert.assertEquals(MarkovOutcome.negative,predictions.get(graph2.findVertex("B")).get(lblU));
    Assert.assertEquals(MarkovOutcome.positive,predictions.get(graph2.findVertex("B")).get(lblB));
View Full Code Here

Examples of statechum.analysis.learning.MarkovUniversalLearner.predictTransitions()

    m.predictTransitionsAndUpdateMarkov(graph,true,true);
    Assert.assertEquals(4,m.getMarkov(true).size());
    Assert.assertTrue(m.getMarkov(false).isEmpty());
   
    final LearnerGraph graph2 = new LearnerGraph(config);graph2.getInit().setAccept(false);
    Map<CmpVertex, Map<Label, MarkovOutcome>> predictions = m.predictTransitions(graph2,true);
    Assert.assertTrue(predictions.isEmpty());
    predictions = m.predictTransitions(graph2,false);
    Assert.assertTrue(predictions.isEmpty());
  }
 
View Full Code Here

Examples of statechum.analysis.learning.MarkovUniversalLearner.predictTransitions()

    Assert.assertTrue(m.getMarkov(false).isEmpty());
   
    final LearnerGraph graph2 = new LearnerGraph(config);graph2.getInit().setAccept(false);
    Map<CmpVertex, Map<Label, MarkovOutcome>> predictions = m.predictTransitions(graph2,true);
    Assert.assertTrue(predictions.isEmpty());
    predictions = m.predictTransitions(graph2,false);
    Assert.assertTrue(predictions.isEmpty());
  }
 
  @Test
  public void testPredictTransitionsFromStatesForward3()
View Full Code Here

Examples of statechum.analysis.learning.MarkovUniversalLearner.predictTransitions()

    m.updateMarkov(graph,false,true);
    Assert.assertTrue(m.getMarkov(true).isEmpty());
    Assert.assertEquals(9,m.getMarkov(false).size());
   
    final LearnerGraph graph2 = FsmParser.buildLearnerGraph("A-a->B / A-c->A","testCheckFanoutInconsistencySideways4",config, converter);
    Map<CmpVertex, Map<Label, MarkovOutcome>> predictions = m.predictTransitions(graph2,true);
    Assert.assertTrue(predictions.isEmpty());// empty Markov means no predictions.
  }
 
  @Test
  public void testPredictTransitionsFromStatesForward2a()
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.