Examples of computeOccurrenceMatrix()


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

    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);
    new MarkovClassifier(mOther,graph).updateMarkov(true);
    Assert.assertEquals(m.computePredictionMatrix(),mOther.computePredictionMatrix());
    Assert.assertEquals(m.computeOccurrenceMatrix(),mOther.computeOccurrenceMatrix());
  }
   
  /** Tests that creating a model from PTA and from initial traces gives almost the same result. The difference is in PTA-based construction mis-counting the number of times shorter traces occur since it
   * can see that they exist but not the number of tails they lead to. This is left in because I do not use specific values occurrence counts.
   */
 
View Full Code Here

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

    new MarkovClassifier(mOther,graph).updateMarkov(false);
    Assert.assertEquals(m.computePredictionMatrix(),mOther.computePredictionMatrix());
   
    // Workaround around a deficiency in the calculation of occurrences of prefixes by the PTA-based construction of Markov model.
    Assert.assertEquals(new UpdatablePairInteger(2, 0), m.computeOccurrenceMatrix().get(Arrays.asList(new Label[]{lblA})));
    Assert.assertEquals(new UpdatablePairInteger(1, 0), mOther.computeOccurrenceMatrix().get(Arrays.asList(new Label[]{lblA})));

    Map<List<Label>,UpdatablePairInteger> mOccurrenceMatrix = m.computeOccurrenceMatrix(), mOtherOccurrenceMatrix = mOther.computeOccurrenceMatrix();
    mOccurrenceMatrix.remove(Arrays.asList(new Label[]{lblA}));mOtherOccurrenceMatrix.remove(Arrays.asList(new Label[]{lblA}));
    Assert.assertEquals(mOccurrenceMatrix,mOtherOccurrenceMatrix);
  }
View Full Code Here

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

   
    // Workaround around a deficiency in the calculation of occurrences of prefixes by the PTA-based construction of Markov model.
    Assert.assertEquals(new UpdatablePairInteger(2, 0), m.computeOccurrenceMatrix().get(Arrays.asList(new Label[]{lblA})));
    Assert.assertEquals(new UpdatablePairInteger(1, 0), mOther.computeOccurrenceMatrix().get(Arrays.asList(new Label[]{lblA})));

    Map<List<Label>,UpdatablePairInteger> mOccurrenceMatrix = m.computeOccurrenceMatrix(), mOtherOccurrenceMatrix = mOther.computeOccurrenceMatrix();
    mOccurrenceMatrix.remove(Arrays.asList(new Label[]{lblA}));mOtherOccurrenceMatrix.remove(Arrays.asList(new Label[]{lblA}));
    Assert.assertEquals(mOccurrenceMatrix,mOtherOccurrenceMatrix);
  }

  /** Tests that creating a model from PTA and from initial traces give the same result. */
 
View Full Code Here

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);new MarkovClassifier(mOther,graph).updateMarkov(true);
    Assert.assertEquals(m.computePredictionMatrix(),mOther.computePredictionMatrix());
    Assert.assertEquals(m.computeOccurrenceMatrix(),mOther.computeOccurrenceMatrix());
  }
 
  /** Tests that creating a model from PTA and from initial traces give the same result. */
  @Test
  public void testMarkovUpdate3()
View Full Code Here

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);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

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);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

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

  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);
    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

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

  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);
    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

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

    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);
    new MarkovClassifier(mOther,graph).updateMarkov(true);
    Assert.assertEquals(m.computePredictionMatrix(),mOther.computePredictionMatrix());
    Assert.assertEquals(m.computeOccurrenceMatrix(),mOther.computeOccurrenceMatrix());
  }
   
  /** Tests that creating a model from PTA and from initial traces gives almost the same result. The difference is in PTA-based construction mis-counting the number of times shorter traces occur since it
   * can see that they exist but not the number of tails they lead to. This is left in because I do not use specific values occurrence counts.
   */
 
View Full Code Here

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

    System.out.println("other is "+mOther.computePredictionMatrix());
    Assert.assertEquals(m.computePredictionMatrix(),mOther.computePredictionMatrix());
   
    // Workaround around a deficiency in the calculation of occurrences of prefixes by the PTA-based construction of Markov model.
    Assert.assertEquals(new UpdatablePairInteger(2, 0), m.computeOccurrenceMatrix().get(Arrays.asList(new Label[]{lblA})));
    Assert.assertEquals(new UpdatablePairInteger(1, 0), mOther.computeOccurrenceMatrix().get(Arrays.asList(new Label[]{lblA})));

    Map<List<Label>,UpdatablePairInteger> mOccurrenceMatrix = m.computeOccurrenceMatrix(), mOtherOccurrenceMatrix = mOther.computeOccurrenceMatrix();
    mOccurrenceMatrix.remove(Arrays.asList(new Label[]{lblA}));mOtherOccurrenceMatrix.remove(Arrays.asList(new Label[]{lblA}));
    Assert.assertEquals(mOccurrenceMatrix,mOtherOccurrenceMatrix);
  }
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.