Package statechum.analysis.learning.rpnicore

Examples of statechum.analysis.learning.rpnicore.LearnerGraphND$ignoreNoneClass


  /** 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

            fileA1 = files[fileNum],
            fileA2 = files[(fileNum+1)%files.length],
            fileB1 = files[(fileNum+2)%files.length],
            fileB2 = files[(fileNum+3)%files.length];
       
          LearnerGraphND grA = null, grB = null;
          {
            LearnerGraphND loadedA1 = new LearnerGraphND(config);AbstractPersistence.loadGraph(fileA1, loadedA1,null);
            LearnerGraph loadedA2 = new LearnerGraph(config);AbstractPersistence.loadGraph(fileA2, loadedA2,null);
            grA = LearnerGraphND.UniteTransitionMatrices(loadedA1,loadedA2);
            addColourAndTransitionsRandomly(grA, new Random(0));
          }
         
          {
            LearnerGraphND loadedB1 = new LearnerGraphND(config);AbstractPersistence.loadGraph(fileB1, loadedB1,null);
            LearnerGraph loadedB2 = new LearnerGraph(config);AbstractPersistence.loadGraph(fileB2, loadedB2,null);
            grB = LearnerGraphND.UniteTransitionMatrices(loadedB1,loadedB2);
            addColourAndTransitionsRandomly(grB, new Random(1));
          }
         
View Full Code Here

  {
    Configuration config = Configuration.getDefaultConfiguration().copy();
    config.setGdKeyPairThreshold(1);config.setGdLowToHighRatio(1);
    String name = "testVisual5";
    String common = "A-a->B-p->B\nA-a->C-q->C\nA-a->D-r->D\nS-a-#T";
    LearnerGraphND grA = new LearnerGraphND(FsmParser.buildGraph("A-a->E-s->E\nA-a->F-v->F\nU-a-#V\n"+common,name+"A"),config);
    LearnerGraphND grB = new LearnerGraphND(FsmParser.buildGraph("A-a->G-u->G\nA-a->H-t->H\n"+common,name+"B"),config);
    LearnerGraphND grA_reduced = new LearnerGraphND(config), grB_reduced = new LearnerGraphND(config);
    AbstractPathRoutines.removeRejectStates(grA, grA_reduced);
    AbstractPathRoutines.removeRejectStates(grB, grB_reduced);
    GD<List<CmpVertex>,List<CmpVertex>,LearnerGraphNDCachedData,LearnerGraphNDCachedData> gd =
      new GD<List<CmpVertex>,List<CmpVertex>,LearnerGraphNDCachedData,LearnerGraphNDCachedData>();
    DirectedSparseGraph graph = gd.showGD(grA_reduced,grB_reduced,  ExperimentRunner.getCpuNumber());
View Full Code Here

  public static void main(String[] args) throws IOException{
    //File graphDir = new File(args[0]);//new File(System.getProperty("user.dir")+System.getProperty("file.separator")+"resources"+
    //System.getProperty("file.separator")+"TestGraphs"+System.getProperty("file.separator") +args[0]);
    //String wholePath = graphDir.getAbsolutePath()+File.separator;
    LearnerGraphND graph0 = new LearnerGraphND(Configuration.getDefaultConfiguration().copy()),graph1 = null;
    AbstractPersistence.loadGraph(args[0], graph0);
    if (args.length > 1)
    {
      graph1 = new LearnerGraphND(Configuration.getDefaultConfiguration().copy());;
      AbstractPersistence.loadGraph(args[1], graph1);
    }
    Visualiser.updateFrame(graph0, graph1);Visualiser.waitForKey();
  }
View Full Code Here

  public static DirectedSparseGraph obtainDifferenceGraph(String graphA, String graphB,int counter,boolean display)
  {
    GD<List<CmpVertex>,List<CmpVertex>,LearnerGraphNDCachedData,LearnerGraphNDCachedData> gd =
      new GD<List<CmpVertex>,List<CmpVertex>,LearnerGraphNDCachedData,LearnerGraphNDCachedData>();
    Configuration config = Configuration.getDefaultConfiguration();
    LearnerGraphND grA=new LearnerGraphND(buildGraph(graphA, "labellingDemo_A_"+counter),config),grB=
    new LearnerGraphND(buildGraph(graphB, "labellingDemo_B_"+counter),config);
    DirectedSparseGraph gr = gd.showGD(
        grA,grB,
        ExperimentRunner.getCpuNumber());
    if (display)
    {
View Full Code Here

  public static DirectedSparseGraph obtainDifferenceGraph(String graphA, String graphB,int counter,boolean display, Configuration config)
  {
    GD<List<CmpVertex>,List<CmpVertex>,LearnerGraphNDCachedData,LearnerGraphNDCachedData> gd =
      new GD<List<CmpVertex>,List<CmpVertex>,LearnerGraphNDCachedData,LearnerGraphNDCachedData>();

    LearnerGraphND grA=buildLearnerGraphND(graphA, "labellingDemo_A_"+counter,config),grB=
    buildLearnerGraphND(graphB, "labellingDemo_B_"+counter,config);
    DirectedSparseGraph gr = gd.showGD(
        grA,grB,
        ExperimentRunner.getCpuNumber());
    if (display)
View Full Code Here

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

TOP

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

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.