Package statechum.analysis.learning

Examples of statechum.analysis.learning.MarkovModel


            return !((statechum.analysis.learning.rpnicore.RandomPathGenerator.StateName)name).accept;
          }
        });
        assert sPlus.size() > 0;
        assert sMinus.size() > 0;
        final MarkovModel m= new MarkovModel(chunkLen,true,true);
        m.createMarkovLearner(sPlus, sMinus,false);
       
        pta.clearColours();
        synchronized (AbstractLearnerGraph.syncObj) {
          //PaperUAS.computePTASize(selectionID+" attempt: "+attempt+" with unique: ", pta, referenceGraph);
        }
View Full Code Here


    final Collection<List<Label>> pathsToMerge2=identifyPathsToMerge(merged,referenceGraph,m,!directionForwardOrInverse);
    /*
    m.updateMarkov(merged,predictForwardOrSideways,false);// now we construct sideways learner ...
    m.constructMarkovTentative(graph,predictForwardOrSideways);// ... and use it to add more transitions.
    */
    MarkovModel inverseModel = new MarkovModel(ptaClassifier.model.getChunkLen(),true,!ptaClassifier.model.directionForwardOrInverse);
    MarkovClassifier cl = new MarkovClassifier(inverseModel,ptaClassifier.graph);cl.updateMarkov(false);
    Collection<Set<CmpVertex>> verticesToMergeUsingSideways=cl.buildVerticesToMergeForPaths(pathsOfInterest);
    return verticesToMergeUsingSideways;
  }
View Full Code Here

            return !((statechum.analysis.learning.rpnicore.RandomPathGenerator.StateName)name).accept;
          }
        });
        assert sPlus.size() > 0;
        assert sMinus.size() > 0;
        final MarkovModel m= new MarkovModel(chunkLen,true,true);
        m.createMarkovLearner(sPlus, sMinus,false);
       
        pta.clearColours();

        if (!onlyUsePositives)
          assert pta.getStateNumber() > pta.getAcceptStateNumber() : "graph with only accept states but onlyUsePositives is not set";
View Full Code Here

            return !((statechum.analysis.learning.rpnicore.RandomPathGenerator.StateName)name).accept;
          }
        });
        assert sPlus.size() > 0;
        assert sMinus.size() > 0;
        final MarkovModel m= new MarkovModel(chunkLen,true,true);
        m.createMarkovLearner(sPlus, sMinus,false);
       
        pta.clearColours();

        if (!onlyUsePositives)
          assert pta.getStateNumber() > pta.getAcceptStateNumber() : "graph with only accept states but onlyUsePositives is not set";
View Full Code Here

                            LearnerGraph pta=new LearnerGraph(learnerInitConfiguration.config);
                            for(List<Label> seq:sPlus)
                              pta.paths.augmentPTA(seq,true,false,null);
                            for(List<Label> seq:sMinus)
                              pta.paths.augmentPTA(seq,false,false,null);
                            final MarkovModel m= new MarkovModel(3,true,true,false);

                            new MarkovClassifier(m, pta).updateMarkov(false);// construct Markov chain if asked for.
                            final ConsistencyChecker checker = new MarkovClassifier.DifferentPredictionsInconsistencyNoBlacklistingIncludeMissingPrefixes();
                         
                            pta.clearColours();
View Full Code Here

  /** Tests that creating a model from PTA and from initial traces gives the same result. */
  @Test
  public void testMarkovUpdate1_longest()
  {
    MarkovModel m = new MarkovModel(2,true,true);
    Set<List<Label>> plusStrings = buildSet(new String[][] { new String[]{"a","b"},new String[]{"c","b"} },config,converter), minusStrings = buildSet(new String[][] { new String[]{"a","u"} },config,converter);
    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.predictionsMatrix,mOther.predictionsMatrix);
    Assert.assertEquals(m.occurrenceMatrix,mOther.occurrenceMatrix);
  }
View Full Code Here

   * 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.
   */
  @Test
  public void testMarkovUpdate1_prefixclosed()
  {
    MarkovModel m = new MarkovModel(2,true,true);
    Set<List<Label>> plusStrings = buildSet(new String[][] { new String[]{"a","b"},new String[]{"c","b"} },config,converter), minusStrings = buildSet(new String[][] { new String[]{"a","u"} },config,converter);
    m.createMarkovLearner(plusStrings, minusStrings,false);

    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(false);
    Assert.assertEquals(m.predictionsMatrix,mOther.predictionsMatrix);
   
    // 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.occurrenceMatrix.get(new Trace(Arrays.asList(new Label[]{lblA}),true)));
View Full Code Here

  /** Tests that creating a model from PTA and from initial traces give the same result. */
  @Test
  public void testMarkovUpdate2()
  {
    MarkovModel m = new MarkovModel(2,true,true);
    Set<List<Label>> plusStrings = buildSet(new String[][] { new String[]{"a","b"},new String[]{"c","b"},new String[]{"c","u"} },config,converter), minusStrings = buildSet(new String[][] {},config,converter);
    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.predictionsMatrix,mOther.predictionsMatrix);
    Assert.assertEquals(m.occurrenceMatrix,mOther.occurrenceMatrix);
  }
View Full Code Here

 
  /** Tests that creating a model from PTA and from initial traces give the same result. */
  @Test
  public void testMarkovUpdate3()
  {
    MarkovModel m = new MarkovModel(2,true,true);
    Set<List<Label>> plusStrings = buildSet(new String[][] {},config,converter), minusStrings = buildSet(new String[][] { new String[]{"a","u"} },config,converter);
    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.predictionsMatrix,mOther.predictionsMatrix);
    Assert.assertEquals(m.occurrenceMatrix,mOther.occurrenceMatrix);
  }
View Full Code Here

 
  @Test
  /** Tests that creating a model from PTA and from initial traces give the same result. */
  public void testMarkovUpdate4()
  {
    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,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.predictionsMatrix,mOther.predictionsMatrix);
    Assert.assertEquals(m.occurrenceMatrix,mOther.occurrenceMatrix);
  }
View Full Code Here

TOP

Related Classes of statechum.analysis.learning.MarkovModel

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.