Package statechum.analysis.learning.rpnicore.GDLearnerGraph

Examples of statechum.analysis.learning.rpnicore.GDLearnerGraph.StateBasedRandom


    case SCORE_RANDOMPATHS:
    case SCORE_TESTSET:
      // build (1) deterministic machines for each state and (2) walks from each state.
      int seed = 80;
      TestDiagnostics.getDiagnostics().setStatus("started on walk forward "+DateFormat.getTimeInstance().format(new Date()));
      forward.computeWalkSequences(new StateBasedRandom(new Random(seed)), threads);
      TestDiagnostics.getDiagnostics().setStatus("started on walk inverse "+DateFormat.getTimeInstance().format(new Date()));
      inverse.computeWalkSequences(new StateBasedRandom(new Random(seed)), threads);
      ddrh = DDRH_BCR.class;
      break;
    case SCORE_LINEAR:
      ddrh = DDRH_default.class;
      break;
View Full Code Here


    config.setGdScoreComputationAlgorithm_RandomWalk_ExtraLength(0);
    LearnerGraph gr=new LearnerGraph(FsmParser.buildGraph(NDGraph, "testCount_computeGraphs"), config);
    GDLearnerGraph ndGraph = new GDLearnerGraph(gr,LearnerGraphND.ignoreRejectStates, true);
    //Visualiser.updateFrame(ndGraph.matrixInverse, null);
    //RandomPathGenerator.diameter(ndGraph.matrixInverse);
    ndGraph.computeWalkSequences(new StateBasedRandom(new Random(80)), 1);
   
    Assert.assertNull(WMethod.checkM(new LearnerGraph(FsmParser.buildGraph("A-a->BE-b->CFG-d->F-d->F / CFG-c->DH-f->D-f->D / DH-e->H-e->H","testCount_computeGraphs_A"),config),
        ndGraph.stateToCorrespondingGraph.get(gr.findVertex(VertexID.parseID("A"))).graph));
    Assert.assertNull(WMethod.checkM(new LearnerGraph(FsmParser.buildGraph("B-b->C-c->D-f->D","testCount_computeGraphs_B"),config),
        ndGraph.stateToCorrespondingGraph.get(gr.findVertex(VertexID.parseID("B"))).graph));
View Full Code Here

    config.setGdScoreComputationAlgorithm(GDScoreComputationAlgorithmEnum.SCORE_RANDOMPATHS);
    config.setGdScoreComputationAlgorithm_RandomWalk_NumberOfSequences(2);
    config.setGdScoreComputationAlgorithm_RandomWalk_ExtraLength(0);
    LearnerGraph gr=new LearnerGraph(FsmParser.buildGraph(NDGraph, "testCount_computeGraphs"), config);
    GDLearnerGraph ndGraph = new GDLearnerGraph(gr,LearnerGraphND.ignoreRejectStates, true);
    ndGraph.computeWalkSequences(new StateBasedRandom(new Random(80)), 1);
   
    DetermineDiagonalAndRightHandSide matcher = ndGraph.new DDRH_BCR();
    getMatcherValue(gr,ndGraph,ndGraph.matrixForward, matcher,"C","D");
    Assert.assertEquals(0,matcher.getRightHandSide(),Configuration.fpAccuracy);
    Assert.assertEquals(2*2,matcher.getDiagonal(),Configuration.fpAccuracy);
 
View Full Code Here

  {
    Configuration config = Configuration.getDefaultConfiguration().copy();
    config.setGdScoreComputationAlgorithm(GDScoreComputationAlgorithmEnum.SCORE_TESTSET);
    LearnerGraph gr=new LearnerGraph(FsmParser.buildGraph(NDGraph, "testCount_computeGraphs"), config);
    GDLearnerGraph ndGraph = new GDLearnerGraph(gr,LearnerGraphND.ignoreRejectStates, true);
    ndGraph.computeWalkSequences(new StateBasedRandom(new Random(80)), 1);
   
    DetermineDiagonalAndRightHandSide matcher = ndGraph.new DDRH_BCR();
    getMatcherValue(gr,ndGraph,ndGraph.matrixForward, matcher,"C","D");
    Assert.assertEquals(1./3.,matcher.getRightHandSide(),Configuration.fpAccuracy);
    Assert.assertEquals(2*2,matcher.getDiagonal(),Configuration.fpAccuracy);
 
View Full Code Here

    case SCORE_RANDOMPATHS:
    case SCORE_TESTSET:
      // build (1) deterministic machines for each state and (2) walks from each state.
      int seed = 80;
      TestDiagnostics.getDiagnostics().setStatus("started on walk forward "+DateFormat.getTimeInstance().format(new Date()));
      forward.computeWalkSequences(new StateBasedRandom(seed), threads);
      TestDiagnostics.getDiagnostics().setStatus("started on walk inverse "+DateFormat.getTimeInstance().format(new Date()));
      inverse.computeWalkSequences(new StateBasedRandom(seed), threads);
      ddrh = DDRH_BCR.class;
      break;
    case SCORE_LINEAR:
      ddrh = DDRH_default.class;
      break;
View Full Code Here

    writeMatrix(gr, "cvsExample.csv");
  }
 
 
  public static void writeMatrix(LearnerGraph gr, String name){
    Stack<PairScore> pairScores = gr.pairscores.chooseStatePairs(GDLearnerGraph.PAIR_INCOMPATIBLE*2,10,1,null,LearnerGraphND.ignoreNone, new StateBasedRandom(1));
    ArrayList<StringVertex> vertexList = new ArrayList<StringVertex>();
    DirectedSparseGraph dsg = gr.pathroutines.getGraph();
    vertexList.addAll(dsg.getVertices());
    writeMatrix(pairScores,vertexList,vertexList, name);
  }
View Full Code Here

    config.setGdScoreComputationAlgorithm_RandomWalk_ExtraLength(0);
    LearnerGraph gr=new LearnerGraph(FsmParser.buildGraph(NDGraph, "testCount_computeGraphs"), config);
    GDLearnerGraph ndGraph = new GDLearnerGraph(gr,LearnerGraphND.ignoreRejectStates, true);
    //Visualiser.updateFrame(ndGraph.matrixInverse, null);
    //RandomPathGenerator.diameter(ndGraph.matrixInverse);
    ndGraph.computeWalkSequences(new StateBasedRandom(80), 1);
   
    Assert.assertNull(WMethod.checkM(new LearnerGraph(FsmParser.buildGraph("A-a->BE-b->CFG-d->F-d->F / CFG-c->DH-f->D-f->D / DH-e->H-e->H","testCount_computeGraphs_A"),config),
        ndGraph.stateToCorrespondingGraph.get(gr.findVertex(VertexID.parseID("A"))).graph));
    Assert.assertNull(WMethod.checkM(new LearnerGraph(FsmParser.buildGraph("B-b->C-c->D-f->D","testCount_computeGraphs_B"),config),
        ndGraph.stateToCorrespondingGraph.get(gr.findVertex(VertexID.parseID("B"))).graph));
View Full Code Here

    config.setGdScoreComputationAlgorithm_RandomWalk_NumberOfSequences(200);
    config.setGdScoreComputationAlgorithm_RandomWalk_ExtraLength(0);
    config.setGdScoreComputationAlgorithm_RandomWalk_PathLength(4);
    LearnerGraph gr=new LearnerGraph(FsmParser.buildGraph(NDGraph, "testCount_computeGraphs"), config);
    GDLearnerGraph ndGraph = new GDLearnerGraph(gr,LearnerGraphND.ignoreRejectStates, true);
    ndGraph.computeWalkSequences(new StateBasedRandom(80), 1);
   
    DetermineDiagonalAndRightHandSide matcher = ndGraph.new DDRH_BCR();
    getMatcherValue(gr,ndGraph,ndGraph.matrixForward, matcher,"C","D");
    Assert.assertEquals(4.76190476190,matcher.getRightHandSide(),Configuration.fpAccuracy);
    Assert.assertEquals(2*2,matcher.getDiagonal(),Configuration.fpAccuracy);
 
View Full Code Here

  {
    Configuration config = Configuration.getDefaultConfiguration().copy();
    config.setGdScoreComputationAlgorithm(GDScoreComputationAlgorithmEnum.SCORE_TESTSET);
    LearnerGraph gr=new LearnerGraph(FsmParser.buildGraph(NDGraph, "testCount_computeGraphs"), config);
    GDLearnerGraph ndGraph = new GDLearnerGraph(gr,LearnerGraphND.ignoreRejectStates, true);
    ndGraph.computeWalkSequences(new StateBasedRandom(80), 1);
   
    DetermineDiagonalAndRightHandSide matcher = ndGraph.new DDRH_BCR();
    getMatcherValue(gr,ndGraph,ndGraph.matrixForward, matcher,"C","D");
    Assert.assertEquals(100./3.,matcher.getRightHandSide(),Configuration.fpAccuracy);
    Assert.assertEquals(2*2,matcher.getDiagonal(),Configuration.fpAccuracy);
 
View Full Code Here

    writeMatrix(gr, "cvsExample.csv");
  }
 
 
  public static void writeMatrix(LearnerGraph gr, String name){
    Stack<PairScore> pairScores = gr.pairscores.chooseStatePairs(GDLearnerGraph.PAIR_INCOMPATIBLE*2,10,1,null,LearnerGraphND.ignoreNone, new StateBasedRandom(new Random(1)));
    ArrayList<StringVertex> vertexList = new ArrayList<StringVertex>();
    DirectedSparseGraph dsg = gr.pathroutines.getGraph();
    vertexList.addAll(dsg.getVertices());
    writeMatrix(pairScores,vertexList,vertexList, name);
  }
View Full Code Here

TOP

Related Classes of statechum.analysis.learning.rpnicore.GDLearnerGraph.StateBasedRandom

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.