Package statechum.analysis.learning.rpnicore

Examples of statechum.analysis.learning.rpnicore.LearnerGraphND


  /** Tests non-deterministic case of {@link MarkovClassifier#tracePath}, deterministic case is tested with {@link TestPathTracing}. */
  @Test
  public void testTracePath3()
  {
    final LearnerGraph fsm = FsmParser.buildLearnerGraph("A-a->B-b->C", "testTracePath1",config,converter);
    LearnerGraphND ndFSM = new LearnerGraphND(fsm,config);
    synchronized(AbstractLearnerGraph.syncObj)
    {
      ndFSM.addVertex(ndFSM.addVertex(ndFSM.addVertex(ndFSM.addVertex(fsm.findVertex("A"), true, lblA),true,lblA),true,lblA),true,lblA);
      ndFSM.addVertex(ndFSM.addVertex(ndFSM.addVertex(fsm.findVertex("A"), true, lblA),true,lblA),true,lblA);
    }
    Assert.assertEquals(10,ndFSM.getStateNumber());
    Assert.assertTrue(MarkovClassifier.tracePath(ndFSM,AbstractLearnerGraph.buildList(Arrays.asList(new String[]{}),config,converter),fsm.findVertex("A")));
    Assert.assertTrue(MarkovClassifier.tracePath(ndFSM,AbstractLearnerGraph.buildList(Arrays.asList(new String[]{"a","b"}),config,converter),fsm.findVertex("A")));
    Assert.assertTrue(MarkovClassifier.tracePath(ndFSM,AbstractLearnerGraph.buildList(Arrays.asList(new String[]{"a","a","a"}),config,converter),fsm.findVertex("A")));
    Assert.assertTrue(MarkovClassifier.tracePath(ndFSM,AbstractLearnerGraph.buildList(Arrays.asList(new String[]{"a","a","a","a"}),config,converter),fsm.findVertex("A")));
    Assert.assertFalse(MarkovClassifier.tracePath(ndFSM,AbstractLearnerGraph.buildList(Arrays.asList(new String[]{"a","a","a","a","a"}),config,converter),fsm.findVertex("A")));
View Full Code Here


  /** Tests non-deterministic case of {@link MarkovClassifier#tracePath}, deterministic case is tested with {@link TestPathTracing}. */
  @Test
  public void testTracePath4()
  {
    final LearnerGraph fsm = FsmParser.buildLearnerGraph("A-t->B-b->C", "testTracePath1",config,converter);
    LearnerGraphND ndFSM = new LearnerGraphND(fsm,config);
    synchronized(AbstractLearnerGraph.syncObj)
    {
      ndFSM.addVertex(ndFSM.addVertex(ndFSM.addVertex(ndFSM.addVertex(fsm.findVertex("B"), true, lblA),true,lblA),true,lblA),true,lblA);
      ndFSM.addVertex(ndFSM.addVertex(ndFSM.addVertex(fsm.findVertex("B"), true, lblA),true,lblA),true,lblC);
    }
    Assert.assertEquals(10,ndFSM.getStateNumber());
    Assert.assertTrue(MarkovClassifier.tracePath(ndFSM,AbstractLearnerGraph.buildList(Arrays.asList(new String[]{}),config,converter),fsm.findVertex("A")));
    Assert.assertTrue(MarkovClassifier.tracePath(ndFSM,AbstractLearnerGraph.buildList(Arrays.asList(new String[]{"t","b"}),config,converter),fsm.findVertex("A")));
    Assert.assertTrue(MarkovClassifier.tracePath(ndFSM,AbstractLearnerGraph.buildList(Arrays.asList(new String[]{"t","a","a","a"}),config,converter),fsm.findVertex("A")));
    Assert.assertTrue(MarkovClassifier.tracePath(ndFSM,AbstractLearnerGraph.buildList(Arrays.asList(new String[]{"t","a","a","a","a"}),config,converter),fsm.findVertex("A")));
    Assert.assertTrue(MarkovClassifier.tracePath(ndFSM,AbstractLearnerGraph.buildList(Arrays.asList(new String[]{"t","a","a","c"}),config,converter),fsm.findVertex("A")));
View Full Code Here

  /** Tests non-deterministic case of {@link MarkovClassifier#tracePath}, deterministic case is tested with {@link TestPathTracing}. */
  @Test
  public void testTracePath5()
  {
    final LearnerGraph fsm = FsmParser.buildLearnerGraph("A-t->B-b->C", "testTracePath1",config,converter);
    LearnerGraphND ndFSM = new LearnerGraphND(fsm,config);
    CmpVertex Brej=null;
    synchronized(AbstractLearnerGraph.syncObj)
    {
      ndFSM.addVertex(ndFSM.addVertex(ndFSM.addVertex(ndFSM.addVertex(fsm.findVertex("B"), true, lblA),true,lblA),true,lblA),true,lblA);
      ndFSM.addVertex(ndFSM.addVertex(ndFSM.addVertex(fsm.findVertex("B"), true, lblA),true,lblA),false,lblC);
      Brej=ndFSM.addVertex(ndFSM.addVertex(fsm.findVertex("B"), true, lblA),false,lblB);
      ndFSM.addVertex(Brej,false,lblC);
    }
    Assert.assertEquals(13,ndFSM.getStateNumber());
    Assert.assertTrue(MarkovClassifier.tracePath(ndFSM,AbstractLearnerGraph.buildList(Arrays.asList(new String[]{}),config,converter),fsm.findVertex("A")));
    Assert.assertTrue(MarkovClassifier.tracePath(ndFSM,AbstractLearnerGraph.buildList(Arrays.asList(new String[]{"t","b"}),config,converter),fsm.findVertex("A")));
    Assert.assertTrue(MarkovClassifier.tracePath(ndFSM,AbstractLearnerGraph.buildList(Arrays.asList(new String[]{"t","a","a","a"}),config,converter),fsm.findVertex("A")));
    Assert.assertTrue(MarkovClassifier.tracePath(ndFSM,AbstractLearnerGraph.buildList(Arrays.asList(new String[]{"t","a","a","a","a"}),config,converter),fsm.findVertex("A")));
    Assert.assertFalse(MarkovClassifier.tracePath(ndFSM,AbstractLearnerGraph.buildList(Arrays.asList(new String[]{"t","a","a","c"}),config,converter),fsm.findVertex("A")));
View Full Code Here

    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","testCheckFanoutInconsistency1a",config, converter);
   
    Configuration shallowCopy = graph.config.copy();shallowCopy.setLearnerCloneGraph(false);
    LearnerGraphND Inverse_Graph = new LearnerGraphND(shallowCopy);
    AbstractPathRoutines.buildInverse(graph,LearnerGraphND.ignoreNone,Inverse_Graph)// do the inverse to the tentative graph
    Assert.assertEquals(0,m.checkFanoutInconsistency(Inverse_Graph,true,graph,graph.findVertex("B"),m.getChunkLen(), new MarkovUniversalLearner.DifferentPredictionsInconsistency(graph)));
  }
View Full Code Here

    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 / B-u->F / T-b->T-u->T","testCheckFanoutInconsistency1b1",config, converter);
   
    Configuration shallowCopy = graph.config.copy();shallowCopy.setLearnerCloneGraph(false);
    LearnerGraphND Inverse_Graph = new LearnerGraphND(shallowCopy);
    AbstractPathRoutines.buildInverse(graph,LearnerGraphND.ignoreNone,Inverse_Graph)// do the inverse to the tentative graph
    Assert.assertEquals(1,m.checkFanoutInconsistency(Inverse_Graph,true,graph,graph.findVertex("B"),m.getChunkLen(), new MarkovUniversalLearner.DifferentPredictionsInconsistency(graph)));
  }
View Full Code Here

    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 / A-c->B / B-u->F / T-b->T-u->T","testCheckFanoutInconsistency1b2",config, converter);
   
    Configuration shallowCopy = graph.config.copy();shallowCopy.setLearnerCloneGraph(false);
    LearnerGraphND Inverse_Graph = new LearnerGraphND(shallowCopy);
    AbstractPathRoutines.buildInverse(graph,LearnerGraphND.ignoreNone,Inverse_Graph)// do the inverse to the tentative graph
    Assert.assertEquals(1,m.checkFanoutInconsistency(Inverse_Graph,true,graph,graph.findVertex("B"),m.getChunkLen(), new MarkovUniversalLearner.DifferentPredictionsInconsistency(graph)));
  }
View Full Code Here

    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"},new String[]{"a","d"} },config,converter);
    m.createMarkovLearner(plusStrings, minusStrings,false);
    final LearnerGraph graph = FsmParser.buildLearnerGraph("A-a->B / A-c->B / B-d->F / T-b->T-u->T-d->T","testCheckFanoutInconsistency1c",config, converter);
   
    Configuration shallowCopy = graph.config.copy();shallowCopy.setLearnerCloneGraph(false);
    LearnerGraphND Inverse_Graph = new LearnerGraphND(shallowCopy);
    AbstractPathRoutines.buildInverse(graph,LearnerGraphND.ignoreNone,Inverse_Graph)// do the inverse to the tentative graph
    Assert.assertEquals(1,m.checkFanoutInconsistency(Inverse_Graph,true,graph,graph.findVertex("B"),m.getChunkLen(), new MarkovUniversalLearner.DifferentPredictionsInconsistency(graph)));
  }
View Full Code Here

    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 / B-d->F / T-b->T-u->T-d->T","testCheckFanoutInconsistency1d",config, converter);
   
    Configuration shallowCopy = graph.config.copy();shallowCopy.setLearnerCloneGraph(false);
    LearnerGraphND Inverse_Graph = new LearnerGraphND(shallowCopy);
    AbstractPathRoutines.buildInverse(graph,LearnerGraphND.ignoreNone,Inverse_Graph)// do the inverse to the tentative graph
    Assert.assertEquals(1,m.checkFanoutInconsistency(Inverse_Graph,true,graph,graph.findVertex("B"),m.getChunkLen(), new MarkovUniversalLearner.DifferentPredictionsInconsistency(graph)));
  }
View Full Code Here

    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 / B-b-#F / T-b->T-u->T-d->T","testCheckFanoutInconsistency1e",config, converter);
   
    Configuration shallowCopy = graph.config.copy();shallowCopy.setLearnerCloneGraph(false);
    LearnerGraphND Inverse_Graph = new LearnerGraphND(shallowCopy);
    AbstractPathRoutines.buildInverse(graph,LearnerGraphND.ignoreNone,Inverse_Graph)// do the inverse to the tentative graph
    Assert.assertEquals(1,m.checkFanoutInconsistency(Inverse_Graph,true,graph,graph.findVertex("B"),m.getChunkLen(), new MarkovUniversalLearner.DifferentPredictionsInconsistency(graph)));
  }
View Full Code Here

    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 / B-d-#F / T-b->T-u->T-d->T","testCheckFanoutInconsistency1f",config, converter);
   
    Configuration shallowCopy = graph.config.copy();shallowCopy.setLearnerCloneGraph(false);
    LearnerGraphND Inverse_Graph = new LearnerGraphND(shallowCopy);
    AbstractPathRoutines.buildInverse(graph,LearnerGraphND.ignoreNone,Inverse_Graph)// do the inverse to the tentative graph
    Assert.assertEquals(1,m.checkFanoutInconsistency(Inverse_Graph,true,graph,graph.findVertex("B"),m.getChunkLen(), new MarkovUniversalLearner.DifferentPredictionsInconsistency(graph)));
   
    Assert.assertEquals(4.,MarkovUniversalLearner.computeInconsistency(graph, true, m, new MarkovUniversalLearner.DifferentPredictionsInconsistency(graph)),Configuration.fpAccuracy);// inconsistencies detected are mostly due to state T
  }
View Full Code Here

TOP

Related Classes of statechum.analysis.learning.rpnicore.LearnerGraphND

Copyright © 2018 www.massapicom. 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.