Package statechum.analysis.learning

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


  public void testCheckFanoutInconsistencySideways3()
  {
    final LearnerGraph graph = FsmParser.buildLearnerGraph("A-a->B-b->C / B-u-#D / A-c->E-u->F / E-c->G","testUpdateMarkovSideways3",config, converter);
    MarkovModel m = new MarkovModel(2,false,true);
    new MarkovClassifier(m,graph).updateMarkov(false);
    Assert.assertEquals(9+graph.getCache().getAlphabet().size(),m.computePredictionMatrix().size());
   
    final LearnerGraph graph2 = FsmParser.buildLearnerGraph("A-a->B","testCheckFanoutInconsistencySideways3",config, converter);
    final AtomicInteger counterA=new AtomicInteger(0),counterB=new AtomicInteger(0);
    Assert.assertEquals(0,new MarkovClassifier(m, graph2).checkFanoutInconsistency(graph2.getInit(), new MarkovClassifier.ConsistencyChecker(){
View Full Code Here


  public void testCheckFanoutInconsistencySideways4()
  {
    final LearnerGraph graph = FsmParser.buildLearnerGraph("A-a->B-b->C / B-u-#D / A-c->E-u->F / E-c->G","testUpdateMarkovSideways3",config, converter);
    MarkovModel m = new MarkovModel(2,false,true);
    new MarkovClassifier(m,graph).updateMarkov(false);
    Assert.assertEquals(9+graph.getCache().getAlphabet().size(),m.computePredictionMatrix().size());
   
    final LearnerGraph graph2 = FsmParser.buildLearnerGraph("A-a->B / A-c->A","testCheckFanoutInconsistencySideways4",config, converter);
    final AtomicInteger counterA=new AtomicInteger(0),counterB=new AtomicInteger(0);
    Assert.assertEquals(0,new MarkovClassifier(m, graph2).checkFanoutInconsistency(graph2.getInit(), new MarkovClassifier.ConsistencyChecker(){
View Full Code Here

  public void testCheckFanoutInconsistencySideways5()
  {
    final LearnerGraph graph = FsmParser.buildLearnerGraph("A-a->B-b->C / B-u-#D / A-c->E-u->F / E-c->G","testUpdateMarkovSideways3",config, converter);
    MarkovModel m = new MarkovModel(2,false,true);
    new MarkovClassifier(m,graph).updateMarkov(false);
    Assert.assertEquals(9+graph.getCache().getAlphabet().size(),m.computePredictionMatrix().size());
   
    final LearnerGraph graph2 = FsmParser.buildLearnerGraph("A-a->B","testCheckFanoutInconsistencySideways3",config, converter);
    final AtomicInteger counterA=new AtomicInteger(0),counterB=new AtomicInteger(0);
    Assert.assertEquals(0,new MarkovClassifier(m, graph2).checkFanoutInconsistency(graph2.getInit(), new MarkovClassifier.ConsistencyChecker(){
View Full Code Here

  public void testCheckFanoutInconsistencySideways6()
  {
    final LearnerGraph graph = FsmParser.buildLearnerGraph("A-a->B-b->C / B-u-#D / A-c->E-u->F / E-c->G","testUpdateMarkovSideways3",config, converter);
    MarkovModel m = new MarkovModel(2,false,true);
    new MarkovClassifier(m,graph).updateMarkov(false);
    Assert.assertEquals(9+graph.getCache().getAlphabet().size(),m.computePredictionMatrix().size());
   
    final LearnerGraph graph2 = FsmParser.buildLearnerGraph("A-a->B / A-c->A","testCheckFanoutInconsistencySideways4",config, converter);
    final AtomicInteger counterA=new AtomicInteger(0),counterB=new AtomicInteger(0);
    Assert.assertEquals(0,new MarkovClassifier(m, graph2).checkFanoutInconsistency(graph2.getInit(), new MarkovClassifier.ConsistencyChecker(){
View Full Code Here

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

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

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

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

  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

  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

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.