Package statechum.analysis.learning

Examples of statechum.analysis.learning.MarkovModel$MarkovMatrixEngine


  }
 
  @Test
  public void testCreateMarkovMatrix1()
  {
    MarkovModel m = new MarkovModel(2,true,true);
    Set<List<Label>> plusStrings = buildSet(new String[][] { new String[]{"a","b","c"}, new String[]{"a","b"}, new String[]{"a","d","c"}},config,converter), minusStrings = buildSet(new String[][] { new String[]{"a","b","c","d"}, new String[]{"a","u"} },config,converter);
    Map<Trace, MarkovOutcome> matrix = m.createMarkovLearner(plusStrings, minusStrings,false);
    Assert.assertEquals(11,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[]{lblD,lblC}),true)));
View Full Code Here


  }
 
  @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);
    m.createMarkovLearner(plusStrings, minusStrings,false);
    Map<List<Label>, MarkovOutcome> matrix = m.computePredictionMatrix();
    Assert.assertEquals(1,matrix.size());

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

 

  @Test
  public void testCreateMarkovMatrix2()
  {
    MarkovModel m = new MarkovModel(2,true,true);
    Set<List<Label>> plusStrings = buildSet(new String[][] { new String[]{"a","u"} },config,converter), minusStrings = new HashSet<List<Label>>();
    Map<Trace, MarkovOutcome> matrix = m.createMarkovLearner(plusStrings, minusStrings,false);
    Assert.assertEquals(3,matrix.size());
   
    Assert.assertSame(MarkovOutcome.positive, 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 testCreateMarkovMatrix3a()
  {
    MarkovModel m = new MarkovModel(2,true,true);
    Set<List<Label>> plusStrings = new HashSet<List<Label>>(), minusStrings = buildSet(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

 
  /** 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);
    m.createMarkovLearner(plusStrings, minusStrings,false);
    Map<List<Label>, MarkovOutcome> matrix = m.computePredictionMatrix();
    Assert.assertEquals(3,matrix.size());
   
    Assert.assertSame(MarkovOutcome.negative, matrix.get(Arrays.asList(new Label[]{lblA,lblU})));
    Assert.assertSame(MarkovOutcome.positive, matrix.get(Arrays.asList(new Label[]{lblA})));
    Assert.assertSame(MarkovOutcome.negative, matrix.get(Arrays.asList(new Label[]{lblU})));
View Full Code Here

 
  /** Only differs from 3a by the use of chunk_length of 3. The outcome should be the same. */
  @Test
  public void testCreateMarkovMatrix3b()
  {
    MarkovModel m = new MarkovModel(3,true,true);
    Set<List<Label>> plusStrings = new HashSet<List<Label>>(), minusStrings = buildSet(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 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

  }
 
  @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

 
  /** 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

TOP

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

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.