Package statechum.analysis.learning

Examples of statechum.analysis.learning.MarkovClassifier$InconsistencyNullVsPredicted


    MarkovModel m = new MarkovModel(2,true,true);
    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);
   
    Assert.assertEquals(1,new MarkovClassifier(m,graph).checkFanoutInconsistency(graph.findVertex("B"),new MarkovClassifier.DifferentPredictionsInconsistency()));
  }
View Full Code Here


  public void testBuildVerticesToMergeForPath2()
  {
    LearnerGraph gr=FsmParser.buildLearnerGraph("A-a->B / A-b->A / B-a->C-b->D-a->E / D-c->D / E-d->E","testBuildVerticesToMergeForPath1",config, converter);
    Collection<List<Label>> paths = new LinkedList<List<Label>>();paths.add(Arrays.asList(new Label[]{lblA}));paths.add(Arrays.asList(new Label[]{lblB}));paths.add(Arrays.asList(new Label[]{lblC}));
    //for(LearnerGraph g:grForPaths.values())  System.out.println(g.transitionMatrix);
    Collection<Set<CmpVertex>> collectionOfSets = new MarkovClassifier(new MarkovModel(2,true,true),gr).buildVerticesToMergeForPaths(paths);
    Assert.assertEquals(1,collectionOfSets.size());
    Iterator<Set<CmpVertex>> iterator = collectionOfSets.iterator();
    Set<CmpVertex> partA = new TreeSet<CmpVertex>();partA.addAll(gr.transitionMatrix.keySet());partA.remove(gr.findVertex("E"));
   
    Assert.assertEquals(partA, iterator.next());
View Full Code Here

    MarkovModel m = new MarkovModel(2,true,true);
    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);
   
    Assert.assertEquals(1,new MarkovClassifier(m,graph).checkFanoutInconsistency(graph.findVertex("B"),new MarkovClassifier.DifferentPredictionsInconsistency()));
  }
View Full Code Here

    MarkovModel m = new MarkovModel(2,true,true);
    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);
   
    Assert.assertEquals(1,new MarkovClassifier(m,graph).checkFanoutInconsistency(graph.findVertex("B"),new MarkovClassifier.DifferentPredictionsInconsistency()));
  }
View Full Code Here

  public void testBuildVerticesToMergeForPath3()
  {
    LearnerGraph gr=FsmParser.buildLearnerGraph("A-a->B / A-b->A / B-a->C-b->D-a->E / D-c->D / E-d->E","testBuildVerticesToMergeForPath3",config, converter);
    Collection<List<Label>> paths = new LinkedList<List<Label>>();paths.add(Arrays.asList(new Label[]{lblA}));paths.add(Arrays.asList(new Label[]{lblB}));paths.add(Arrays.asList(new Label[]{lblC}));paths.add(Arrays.asList(new Label[]{lblD}));
    //for(LearnerGraph g:grForPaths.values())  System.out.println(g.transitionMatrix);
    Collection<Set<CmpVertex>> collectionOfSets=new MarkovClassifier(new MarkovModel(2,true,true),gr).buildVerticesToMergeForPaths(paths);
    Assert.assertEquals(2,collectionOfSets.size());
    Iterator<Set<CmpVertex>> iterator = collectionOfSets.iterator();
    Set<CmpVertex> partA = new TreeSet<CmpVertex>();partA.addAll(gr.transitionMatrix.keySet());partA.remove(gr.findVertex("E"));
    Set<CmpVertex> partB = new TreeSet<CmpVertex>();partB.add(gr.findVertex("E"));
   
View Full Code Here

    MarkovModel m = new MarkovModel(2,true,true);
    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);
   
    Assert.assertEquals(1,new MarkovClassifier(m,graph).checkFanoutInconsistency(graph.findVertex("B"),new MarkovClassifier.DifferentPredictionsInconsistency()));
   
    Assert.assertEquals(4.,MarkovClassifier.computeInconsistency(graph,  m, new MarkovClassifier.DifferentPredictionsInconsistency(),false),Configuration.fpAccuracy);// inconsistencies detected are mostly due to state T
  }
View Full Code Here

    MarkovModel m = new MarkovModel(2,true,true);
    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->C / B-u->F / T-b->T-u->T","testCheckFanoutInconsistency2",config, converter);
   
    Assert.assertEquals(2,new MarkovClassifier(m,graph).checkFanoutInconsistency(graph.findVertex("B"),new MarkovClassifier.DifferentPredictionsInconsistency()));
  }
View Full Code Here

  public void testBuildVerticesToMergeForPath4()
  {
    LearnerGraph gr=FsmParser.buildLearnerGraph("A-a->B / A-b->A / B-a->C-d->D-a->E / D-c->D / E-d->E","testBuildVerticesToMergeForPath4",config, converter);
    Collection<List<Label>> paths = new LinkedList<List<Label>>();paths.add(Arrays.asList(new Label[]{lblA}));paths.add(Arrays.asList(new Label[]{lblB}));paths.add(Arrays.asList(new Label[]{lblC}));paths.add(Arrays.asList(new Label[]{lblD}));
    //for(LearnerGraph g:grForPaths.values())  System.out.println(g.transitionMatrix);
    Collection<Set<CmpVertex>> collectionOfSets=new MarkovClassifier(new MarkovModel(2,true,true),gr).buildVerticesToMergeForPaths(paths);
    Assert.assertEquals(2,collectionOfSets.size());
    Iterator<Set<CmpVertex>> iterator = collectionOfSets.iterator();
    Set<CmpVertex> partA = new TreeSet<CmpVertex>();partA.addAll(gr.transitionMatrix.keySet());partA.remove(gr.findVertex("E"));partA.remove(gr.findVertex("C"));
    Set<CmpVertex> partB = new TreeSet<CmpVertex>();partB.add(gr.findVertex("E"));partB.add(gr.findVertex("C"));
   
View Full Code Here

    MarkovModel m = new MarkovModel(2,true,true);
    Set<List<Label>> plusStrings = buildSet(new String[][] { new String[]{"a","b"},new String[]{"c","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-u->C / T-b->T-u->T","testCheckFanoutInconsistency3",config, converter);
   
    Assert.assertEquals(1,new MarkovClassifier(m,graph).checkFanoutInconsistency(graph.findVertex("B"),new MarkovClassifier.DifferentPredictionsInconsistency()));
  }
View Full Code Here

    Set<List<Label>> plusStrings = buildSet(new String[][] { new String[]{"a","b"},new String[]{"c","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->D-b->C / A-c->B-b->C / B-u->E / T-b->T-u->T","testCheckFanoutInconsistency4",config, converter);
   
   
    Assert.assertEquals(0,new MarkovClassifier(m,graph).checkFanoutInconsistency(graph.findVertex("B"),new MarkovClassifier.DifferentPredictionsInconsistency()));// everything as expected.
    Assert.assertEquals(0,new MarkovClassifier(m,graph).checkFanoutInconsistency(graph.findVertex("D"),new MarkovClassifier.DifferentPredictionsInconsistency()));// missing reject-transition with label u is ignored because we are only considering actual outgoing transitions
  }
View Full Code Here

TOP

Related Classes of statechum.analysis.learning.MarkovClassifier$InconsistencyNullVsPredicted

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.