Package statechum.analysis.learning

Examples of statechum.analysis.learning.MarkovModel$MarkovOutcome


  }
 
  @Test
  public void testCreateMarkovMatrix4()
  {
    MarkovModel m = new MarkovModel(2,true,true);
    Set<List<Label>> plusStrings = new HashSet<List<Label>>(), minusStrings = buildSet(new String[][] { new String[]{"u"} },config,converter);
    Map<Trace, MarkovOutcome> matrix = m.createMarkovLearner(plusStrings, minusStrings,false);
    Assert.assertEquals(1,matrix.size());

    Assert.assertSame(MarkovOutcome.negative, matrix.get(new Trace(Arrays.asList(new Label[]{lblU}),true)));
  }
View Full Code Here


 
  /** Same as testCreateMarkovMatrix3 but contains an empty trace which is ignored since it does not match any of the valid chunk sizes. */
  @Test
  public void testCreateMarkovMatrix5()
  {
    final MarkovModel m = new MarkovModel(2,true,true);
    final Set<List<Label>> plusStrings = new HashSet<List<Label>>(), minusStrings = buildSet(new String[][] { new String[]{},new String[]{"a","u"} },config,converter);
    Map<Trace, MarkovOutcome> matrix = m.createMarkovLearner(plusStrings, minusStrings,false);
    Assert.assertEquals(3,matrix.size());
   
    Assert.assertSame(MarkovOutcome.negative, matrix.get(new Trace(Arrays.asList(new Label[]{lblA,lblU}),true)));

    Assert.assertSame(MarkovOutcome.positive, matrix.get(new Trace(Arrays.asList(new Label[]{lblA}),true)));
View Full Code Here

  }
 
  @Test
  public void testCreateMarkovMatrix6()
  {
    final MarkovModel m = new MarkovModel(2,true,true);
    final Set<List<Label>> plusStrings = new HashSet<List<Label>>(), minusStrings = new HashSet<List<Label>>();
    Helper.checkForCorrectException(new whatToRun() {
      @Override
      public void run() throws NumberFormatException
      {
        m.createMarkovLearner(plusStrings, minusStrings,false);
      }
    }, IllegalArgumentException.class, "empty");
  }
View Full Code Here

  }
 
  @Test
  public void testCreateMarkovMatrix7()
  {
    final MarkovModel m = new MarkovModel(2,true,true);
    final Set<List<Label>> plusStrings = new HashSet<List<Label>>(), minusStrings = buildSet(new String[][] { new String[]{},new String[]{} },config,converter);
    Helper.checkForCorrectException(new whatToRun() {
      @Override
      public void run() throws NumberFormatException
      {
        m.createMarkovLearner(plusStrings, minusStrings,false);
      }
    }, IllegalArgumentException.class, "empty");
  }
View Full Code Here

 
  /** Nothing to add because there not enough evidence. */
  @Test
  public void testConstructExtendedGraph1()
  {
    MarkovModel m = new MarkovModel(2,true,true);
    Set<List<Label>> plusStrings = buildSet(new String[][] { new String[]{"a","p"} },config,converter), minusStrings = buildSet(new String[][] { new String[]{"a","u"} },config,converter);
    m.createMarkovLearner(plusStrings, minusStrings,false);
    final LearnerGraph graph = FsmParser.buildLearnerGraph("A-u->B-p->B","testConstructExtendedGraph1",config, converter);
    MarkovClassifier cl = new MarkovClassifier(m,graph);
    Map<CmpVertex, Map<Label, MarkovOutcome>> newTransitions = cl.predictTransitions();
    Assert.assertTrue(newTransitions.isEmpty());// not enough evidence to update, hence nothing should be recorded.
    final LearnerGraph expected = FsmParser.buildLearnerGraph("A-u->B-p->B","testConstructExtendedGraph1",config, converter);
View Full Code Here

 
  /** Nothing to add because the alphabet of the graph of interest consists of a single letter for which there is no statistical data. */
  @Test
  public void testConstructExtendedGraph2()
  {
    MarkovModel m = new MarkovModel(2,true,true);
    Set<List<Label>> plusStrings = buildSet(new String[][] { new String[]{"a","p"} },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","testConstructExtendedGraph2",config, converter);
    MarkovClassifier cl = new MarkovClassifier(m,graph);
    Map<CmpVertex, Map<Label, MarkovOutcome>> newTransitions = cl.predictTransitions();
    Assert.assertTrue(newTransitions.isEmpty());// not enough evidence to update, hence nothing should be recorded.
    final LearnerGraph expected = FsmParser.buildLearnerGraph("A-a->B","testConstructExtendedGraph2",config, converter);
View Full Code Here

 
  /** A bit has been added. */
  @Test
  public void testConstructExtendedGraph3()
  {
    MarkovModel m = new MarkovModel(2,true,true);
    Set<List<Label>> plusStrings = buildSet(new String[][] { new String[]{"a","b"} },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.

View Full Code Here

 
  /** A bit has been added, but reject-transition was not because is present both in the positive and negative light in the initial traces. */
  @Test
  public void testConstructExtendedGraph4()
  {
    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.

View Full Code Here

 
  /** A bit has been added, but reject-transition was not because is present both in the positive and negative light in the initial traces. */
  @Test
  public void testConstructExtendedGraph5()
  {
    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());

View Full Code Here

 
  /** Nothing has been added. u has been seen both in the positive and negative light and lead to inconsistency. */
  @Test
  public void testConstructExtendedGraph6()
  {
    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());
View Full Code Here

TOP

Related Classes of statechum.analysis.learning.MarkovModel$MarkovOutcome

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.