Package statechum.analysis.learning

Examples of statechum.analysis.learning.MarkovClassifier$ForEachCollectionOfPaths


  {
    MarkovModel m = new MarkovModel(2,true,true);
    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 / T-b->T-u->T","testConstructExtendedGraph3a",config, converter);
    MarkovClassifier cl = new MarkovClassifier(m,graph);
    Map<CmpVertex, Map<Label, MarkovOutcome>> newTransitions = cl.predictTransitions();
    Assert.assertEquals(1,newTransitions.size());// not enough evidence to update, hence nothing should be recorded.

    Assert.assertFalse(newTransitions.get(graph.findVertex("B")).containsKey(lblU));// failure ignored
   
    Assert.assertSame(MarkovOutcome.positive, newTransitions.get(graph.findVertex("B")).get(lblB));

    final LearnerGraph expected = FsmParser.buildLearnerGraph("A-a->B-b->C / T-b->T-u->T","testConstructExtendedGraph4b",config, converter);
    LearnerGraph actual = cl.constructMarkovTentative();
    DifferentFSMException ex = WMethod.checkM(expected, actual);
    if (ex != null)
      throw ex;
    Assert.assertNotSame(graph, actual);
  }
View Full Code Here


  {
    MarkovModel m = new MarkovModel(2,true,true);// w below is to ensure that all elements of the alphabet are included in traces.
    Set<List<Label>> plusStrings = buildSet(new String[][] { new String[]{"a","b"},new String[]{"c","u"},new String[]{"w"} },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-w->M-c->B / T-b->T-u->T","testConstructExtendedGraph5a",config, converter);// the purpose of the w-transition is to ensure transition c is taken into account in graph comparison
    MarkovClassifier cl = new MarkovClassifier(m,graph);
    Map<CmpVertex, Map<Label, MarkovOutcome>> newTransitions = cl.predictTransitions();
    Assert.assertEquals(1,newTransitions.size());

    Assert.assertEquals(1,newTransitions.get(graph.findVertex("B")).size());
   
    Assert.assertSame(MarkovOutcome.positive,newTransitions.get(graph.findVertex("B")).get(lblB));

    final LearnerGraph expected = FsmParser.buildLearnerGraph("A-a->B-b->C / A-w->M-c->B / T-b->T-u->T","testConstructExtendedGraph5b",config, converter);
    LearnerGraph actual = cl.constructMarkovTentative();
    DifferentFSMException ex = WMethod.checkM(expected, actual);
    if (ex != null)
      throw ex;
    Assert.assertNotSame(graph, actual);
  }
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 / T-b->T-u->T","testConstructExtendedGraph6a",config, converter);
    MarkovClassifier cl = new MarkovClassifier(m,graph);
    Map<CmpVertex, Map<Label, MarkovOutcome>> newTransitions = cl.predictTransitions();
   
    Assert.assertEquals(1,newTransitions.size());

    Assert.assertEquals(1,newTransitions.get(graph.findVertex("B")).size());
   
    Assert.assertSame(MarkovOutcome.positive, newTransitions.get(graph.findVertex("B")).get(lblB));

    final LearnerGraph expected = FsmParser.buildLearnerGraph("A-a->B / A-c->B / B-b->C / T-b->T-u->T","testConstructExtendedGraph6b",config, converter);
    LearnerGraph actual = cl.constructMarkovTentative();
    DifferentFSMException ex = WMethod.checkM(expected, actual);
    if (ex != null)
      throw ex;
    Assert.assertNotSame(graph, actual);
  }
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-c->Z / T-b->T-u->T","testConstructExtendedGraph7a",config, converter);
    MarkovClassifier cl = new MarkovClassifier(m,graph);
    Map<CmpVertex, Map<Label, MarkovOutcome>> newTransitions = cl.predictTransitions();
   
    Assert.assertEquals(2,newTransitions.size());

    Assert.assertEquals(1,newTransitions.get(graph.findVertex("B")).size());
    Assert.assertEquals(1,newTransitions.get(graph.findVertex("Z")).size());
   
    Assert.assertSame(MarkovOutcome.positive, newTransitions.get(graph.findVertex("B")).get(lblB));
    Assert.assertSame(MarkovOutcome.positive, newTransitions.get(graph.findVertex("Z")).get(lblU));

    final LearnerGraph expected = FsmParser.buildLearnerGraph("A-a->B / A-c->B-c->Z-u->Y / B-b->C / T-b->T-u->T","testConstructExtendedGraph7b",config, converter);
    LearnerGraph actual = cl.constructMarkovTentative();
    DifferentFSMException ex = WMethod.checkM(expected, actual);
    if (ex != null)
      throw ex;
    Assert.assertNotSame(graph, actual);
  }
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 / T-b->T-u->T","testCheckFanoutInconsistency1a",config, converter);
   
    Assert.assertEquals(0,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-u->F / T-b->T-u->T","testCheckFanoutInconsistency1b1",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[]{"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);
   
    Assert.assertEquals(0,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[]{"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);
   
    Assert.assertEquals(1,new MarkovClassifier(m,graph).checkFanoutInconsistency(graph.findVertex("B"),new MarkovClassifier.DifferentPredictionsInconsistency()
    {

      /**
       * @see statechum.analysis.learning.MarkovClassifier.DifferentPredictionsInconsistency#obtainAlphabet(statechum.analysis.learning.rpnicore.AbstractLearnerGraph, statechum.DeterministicDirectedSparseGraph.CmpVertex)
       */
 
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"},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

    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

TOP

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

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.