Package statechum.analysis.learning

Examples of statechum.analysis.learning.MarkovModel.computeOccurrenceMatrix()


    m.createMarkovLearner(plusStrings, minusStrings,true);

    final LearnerGraph graph = new LearnerGraph(config);graph.paths.augmentPTA(plusStrings, true, false);graph.paths.augmentPTA(minusStrings, false, false);
    MarkovModel mOther = new MarkovModel(2,true,true,markovPTAUseMatrix);new MarkovClassifier(mOther,graph).updateMarkov(true);
    Assert.assertEquals(m.computePredictionMatrix(),mOther.computePredictionMatrix());
    Assert.assertEquals(m.computeOccurrenceMatrix(),mOther.computeOccurrenceMatrix());
  }
 
  @Test
  /** Tests that creating a model from PTA and from initial traces give the same result. */
  public void testMarkovUpdate4()
View Full Code Here


    m.createMarkovLearner(plusStrings, minusStrings,true);

    final LearnerGraph graph = new LearnerGraph(config);graph.paths.augmentPTA(plusStrings, true, false);graph.paths.augmentPTA(minusStrings, false, false);
    MarkovModel mOther = new MarkovModel(2,true,true,markovPTAUseMatrix);new MarkovClassifier(mOther,graph).updateMarkov(true);
    Assert.assertEquals(m.computePredictionMatrix(),mOther.computePredictionMatrix());
    Assert.assertEquals(m.computeOccurrenceMatrix(),mOther.computeOccurrenceMatrix());
  }
 
  @Test
  public void testUpdateMarkovSideways1a()
  {
View Full Code Here

  public void testUpdateMarkovSideways1a()
  {
    final LearnerGraph graph = FsmParser.buildLearnerGraph("A-a->B-a->C / B-b->C","testUpdateMarkovSideways1",config, converter);
    MarkovModel m = new MarkovModel(2,false,true,markovPTAUseMatrix);
    new MarkovClassifier(m,graph).updateMarkov(true);
    Map<List<Label>,UpdatablePairInteger> mOccurrenceMatrix = m.computeOccurrenceMatrix();Map<List<Label>,MarkovOutcome> mPredictionsMatrix = m.computePredictionMatrix();
    Assert.assertEquals(4,mPredictionsMatrix.size());
    Assert.assertEquals(4,mOccurrenceMatrix.size());
    Assert.assertEquals(MarkovOutcome.positive,mPredictionsMatrix.get(Arrays.asList(new Label[]{lblA,lblA})));Assert.assertEquals(new UpdatablePairInteger(2, 0),mOccurrenceMatrix.get(Arrays.asList(new Label[]{lblA,lblA})));
    Assert.assertEquals(MarkovOutcome.positive,mPredictionsMatrix.get(Arrays.asList(new Label[]{lblA,lblB})));Assert.assertEquals(new UpdatablePairInteger(1, 0),mOccurrenceMatrix.get(Arrays.asList(new Label[]{lblA,lblB})));
    Assert.assertEquals(MarkovOutcome.positive,mPredictionsMatrix.get(Arrays.asList(new Label[]{lblB,lblA})));Assert.assertEquals(new UpdatablePairInteger(1, 0),mOccurrenceMatrix.get(Arrays.asList(new Label[]{lblB,lblA})));
View Full Code Here

  public void testUpdateMarkovSideways1b()
  {
    final LearnerGraph graph = FsmParser.buildLearnerGraph("A-a->B-a->C / B-b->C","testUpdateMarkovSideways1",config, converter);
    MarkovModel m = new MarkovModel(2,false,true,markovPTAUseMatrix);
    new MarkovClassifier(m,graph).updateMarkov(false);
    Map<List<Label>,UpdatablePairInteger> mOccurrenceMatrix = m.computeOccurrenceMatrix();Map<List<Label>,MarkovOutcome> mPredictionsMatrix = m.computePredictionMatrix();
    Assert.assertEquals(6,mPredictionsMatrix.size());
    Assert.assertEquals(MarkovOutcome.positive,mPredictionsMatrix.get(Arrays.asList(new Label[]{lblA,lblA})));Assert.assertEquals(new UpdatablePairInteger(2, 0),mOccurrenceMatrix.get(Arrays.asList(new Label[]{lblA,lblA})));
    Assert.assertEquals(MarkovOutcome.positive,mPredictionsMatrix.get(Arrays.asList(new Label[]{lblA,lblB})));Assert.assertEquals(new UpdatablePairInteger(1, 0),mOccurrenceMatrix.get(Arrays.asList(new Label[]{lblA,lblB})));
    Assert.assertEquals(MarkovOutcome.positive,mPredictionsMatrix.get(Arrays.asList(new Label[]{lblB,lblA})));Assert.assertEquals(new UpdatablePairInteger(1, 0),mOccurrenceMatrix.get(Arrays.asList(new Label[]{lblB,lblA})));
    Assert.assertEquals(MarkovOutcome.positive,mPredictionsMatrix.get(Arrays.asList(new Label[]{lblB,lblB})));Assert.assertEquals(new UpdatablePairInteger(1, 0),mOccurrenceMatrix.get(Arrays.asList(new Label[]{lblB,lblB})));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.