Package statechum.analysis.learning.rpnicore

Examples of statechum.analysis.learning.rpnicore.LearnerGraph


   * @param fsm the string representation of the machine which the graph should be isomorphic to
   */
  public void checkEq(DirectedSparseGraph g, String fsm)
  {
    DirectedSparseGraph expectedGraph = buildGraph(fsm,"expected graph");
    final LearnerGraph graph = new LearnerGraph(g,Configuration.getDefaultConfiguration());
    final LearnerGraph expected = new LearnerGraph(expectedGraph,Configuration.getDefaultConfiguration());
   
    assertEquals("incorrect data",true,expected.equals(graph));
  }
View Full Code Here


  }
 
  /** Verifies the equivalence of a supplied graph to the supplied machine. */
  public static void checkM(DirectedSparseGraph g,String fsm,Configuration conf)
  {
    final LearnerGraph graph = new LearnerGraph(g,conf);
    final DirectedSparseGraph expectedGraph = buildGraph(fsm,"expected graph");
    final LearnerGraph expected = new LearnerGraph(expectedGraph,conf);
    WMethod.checkM(graph,expected);
  }
View Full Code Here

  }

  @Test
  public void testCheckM6()
  {
    final LearnerGraph graph = new LearnerGraph(buildGraph("A-a->B-b->B-a->C", "testCheck6"),config);
    final LearnerGraph expected = new LearnerGraph(buildGraph("U<-b-U\nQ<-a-U<-a-S","expected graph"),config);
    assertTrue(checkMBoolean(graph,expected,"A","S"));
    assertTrue(checkMBoolean(graph,expected,"B","U"));
    assertTrue(checkMBoolean(graph,expected,"C","Q"));
  }
View Full Code Here

  }

  @Test
  public final void testCheckM_multipleEq1() // equivalent states
  {
    final LearnerGraph graph = new LearnerGraph(buildGraph("S-a->A\nS-b->B\nS-c->C\nS-d->D\nS-e->E\nS-f->F\nS-h->H-d->H\nA-a->A1-b->A2-a->K1-a->K1\nB-a->B1-b->B2-b->K1\nC-a->C1-b->C2-a->K2-b->K2\nD-a->D1-b->D2-b->K2\nE-a->E1-b->E2-a->K3-c->K3\nF-a->F1-b->F2-b->K3","testCheckM_multipleEq1"),config);
    assertTrue(checkMBoolean(graph,graph,"D","C2"));
    assertTrue(checkMBoolean(graph,graph,"C2","D"));
   
    assertTrue(checkMBoolean(graph,graph,"D1","D2"));
    assertTrue(checkMBoolean(graph,graph,"D2","D1"));
View Full Code Here

  @Test
  public final void testCheckM_multipleEq2() // equivalent states
  {
    final DirectedSparseGraph g = buildGraph("S-a->A-a->D-a->D-b->A-b->B-a->D\nB-b->C-a->D\nC-b->D\nS-b->N-a->N-b->N","testCheckM_multipleEq2");
    final LearnerGraph graph = new LearnerGraph(g,Configuration.getDefaultConfiguration());
    List<String> states = Arrays.asList(new String[]{"S","A","B","C","D","N"});
    for(String stA:states)
      for(String stB:states)
        assertTrue("states "+stA+"and "+stB+" should be equivalent",checkMBoolean(graph,graph,stA,stB));
  }
View Full Code Here

 
  @Test
  public final void testCheckM_multipleEq3() // equivalent states
  {
    final DirectedSparseGraph g = buildGraph("S-a->A-a->D-a->D-b->A-b->B-a->D\nB-b->C-a->D\nC-b->D\nS-b->N-a->M-a->N\nN-b->M-b->N","testCheckM_multipleEq3");
    final LearnerGraph graph = new LearnerGraph(g,Configuration.getDefaultConfiguration());
    List<String> states = Arrays.asList(new String[]{"S","A","B","C","D","N","M"});
    for(String stA:states)
      for(String stB:states)
        assertTrue("states "+stA+"and "+stB+" should be equivalent",checkMBoolean(graph,graph,stA,stB));
  }
View Full Code Here

 
  @Test
  public final void testCheckM_multipleEq4() // non-equivalent states
  {
    final DirectedSparseGraph g = buildGraph("A-a->B-a->C-a->A-b->C-b->B","testCheckM_multipleEq4");
    final LearnerGraph graph = new LearnerGraph(g,Configuration.getDefaultConfiguration());
    List<String> states = Arrays.asList(new String[]{"A","B","C"});
    for(String stA:states)
      for(String stB:states)
        if (stA.equals(stB))
          assertTrue("states "+stA+" and "+stB+" should be equivalent",checkMBoolean(graph,graph,stA,stB));
View Full Code Here

     * @param config configuration to use for doing the comparison. This is useful to configure Linear (if the comparison is done using Linear).
     * @param cpuNumber the number of processors to use. Usually set to 1 because we run as many experiments as there are CPUs and so individual experiments should not consume more computational power than we have available for them.
     */
    public static DifferenceToReferenceFMeasure estimationOfDifference(LearnerGraph referenceGraph, LearnerGraph actualAutomaton, Collection<List<Label>> testSet)
    {
           LearnerGraph learntGraph = new LearnerGraph(actualAutomaton.config);AbstractPathRoutines.removeRejectStates(actualAutomaton,learntGraph);
           ConfusionMatrix mat = DiffExperiments.classify(testSet, referenceGraph, learntGraph);
      return new DifferenceToReferenceFMeasure(mat);
    }
View Full Code Here

     * @param config configuration to use for doing the comparison. This is useful to configure Linear (if the comparison is done using Linear).
     * @param cpuNumber the number of processors to use. Usually set to 1 because we run as many experiments as there are CPUs and so individual experiments should not consume more computational power than we have available for them.
     */
    public static DifferenceToReferenceLanguageBCR estimationOfDifference(LearnerGraph referenceGraph, LearnerGraph actualAutomaton, Collection<List<Label>> testSet)
    {
           LearnerGraph learntGraph = new LearnerGraph(actualAutomaton.config);AbstractPathRoutines.removeRejectStates(actualAutomaton,learntGraph);
           ConfusionMatrix mat = DiffExperiments.classify(testSet, referenceGraph, learntGraph);
      return new DifferenceToReferenceLanguageBCR(mat);
    }
View Full Code Here

      return String.format("< %g, %g >",valueA,valueB);
    }

    public static DifferenceToReferenceDiff estimationOfDifferenceDiffMeasure(LearnerGraph referenceGraph, LearnerGraph actualAutomaton, Configuration config, int cpuNumber)
    {
           LearnerGraph learntGraph = new LearnerGraph(actualAutomaton.config);AbstractPathRoutines.removeRejectStates(actualAutomaton,learntGraph);
      statechum.analysis.learning.linear.GD<CmpVertex,CmpVertex,LearnerGraphCachedData,LearnerGraphCachedData> gd = new statechum.analysis.learning.linear.GD<CmpVertex,CmpVertex,LearnerGraphCachedData,LearnerGraphCachedData>();
      statechum.analysis.learning.linear.GD.ChangesCounter<CmpVertex,CmpVertex,LearnerGraphCachedData,LearnerGraphCachedData> changesCounter = new statechum.analysis.learning.linear.GD.ChangesCounter<CmpVertex,CmpVertex,LearnerGraphCachedData,LearnerGraphCachedData>(referenceGraph, learntGraph, null);
      gd.computeGD(referenceGraph, learntGraph, cpuNumber,changesCounter,config);
     
      int referenceEdges = referenceGraph.pathroutines.countEdges(), actualEdges = learntGraph.pathroutines.countEdges();
View Full Code Here

TOP

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

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.