Package statechum.analysis.learning.TestFSMAlgo

Examples of statechum.analysis.learning.TestFSMAlgo.FSMStructure


  public String getStatistics(boolean computeW) {
    int edgeCounter = 0;
    for(Entry<CmpVertex,Map<String,CmpVertex>> v:transitionMatrix.entrySet())
      edgeCounter+=v.getValue().size();
   
    FSMStructure fsm = WMethod.getGraphData(getGraph());
   
    String wsetDetails = "";
    try
    {
      if (computeW) wsetDetails = "Wset: "+WMethod.computeWSet(fsm).size()+" seq";
View Full Code Here


   * @return an automaton reduced in the described way.
   */
  public static FSMStructure removeRejectStates(FSMStructure what,Configuration config)
  {
    if (!what.accept.get(what.init)) throw new IllegalArgumentException("initial state cannot be a reject-state");
    FSMStructure result = what.copy();
   
    // Since we'd like to modify a transition matrix, we iterate through states of the original machine and modify the result.
    for(Entry<String,Map<String,String>> entry:what.trans.entrySet())
      if (!what.accept.get(entry.getKey())) result.trans.remove(entry.getKey());// a copied state should be identical to the original one, so doing remove is appropriate
      else
View Full Code Here

  public static Set<List<String>> trimToNegatives(DirectedSparseGraph g, Collection<List<String>> sMinus ){
    Set<List<String>> returnSet = new HashSet<List<String>>();
    Iterator<List<String>> sMinusIt = sMinus.iterator();
    while(sMinusIt.hasNext()){
      List<String> currentString = sMinusIt.next();
      final FSMStructure expected = getGraphData(g);
      int reject = tracePath(expected, currentString);
      returnSet.add(currentString.subList(0, reject+1));
    }
    return returnSet;
  }
View Full Code Here

      String stdOutput = writeResult(currentOutcome,null);// record the failure result in case something fails later and we fail to update the file, such as if we are killed or run out of memory
      if (stdOutput != null) return stdOutput;
     
      buildSetsHalfNegative();
     
      final FSMStructure fsm = WMethod.getGraphData(graph);
      RPNIBlueFringeLearnerTestComponentOpt l = new RPNIBlueFringeLearnerTestComponentOpt(null)
      {
        @Override
        protected int checkWithEndUser(DirectedSparseGraph model,List<String> question, final Object [] moreOptions)
        {
View Full Code Here

  public static Set<List<String>> trimToNegatives(DirectedSparseGraph g, Collection<List<String>> sMinus ){
    Set<List<String>> returnSet = new HashSet<List<String>>();
    Iterator<List<String>> sMinusIt = sMinus.iterator();
    while(sMinusIt.hasNext()){
      List<String> currentString = sMinusIt.next();
      final FSMStructure expected = getGraphData(g);
      int reject = tracePath(expected, currentString);
      returnSet.add(currentString.subList(0, reject+1));
    }
    return returnSet;
  }
View Full Code Here

      int size = 4*graph.numVertices();
      RandomPathGenerator rpg = buildSetsHalfNegative(size);
      sMinus = new HashSet<List<String>>();
      sPlus = new HashSet<List<String>>();
      Collection<List<String>> allPositive = rpg.getAllPaths();
      final FSMStructure fsm = WMethod.getGraphData(graph);
      WMethod wm = new WMethod(fsm,1);
      final AtomicInteger atomicInt = new AtomicInteger(0);
      RPNIBlueFringeLearnerTestComponentOpt l = new RPNIBlueFringeLearnerTestComponentOpt(null)
      {
        @Override
View Full Code Here

      Collection<List<String>> testSet = wm.getFullTestSet();
      testDecorator.writeLearnerEvaluationData(new LearnerEvaluationConfiguration(graph, testSet, recordingConfig,null));
      changeParametersOnLearner(l);
      learningOutcome = testDecorator.learnMachine(plusPTA, minusPTA.getData());
      l.setQuestionCounter(0);
      FSMStructure learned = WMethod.getGraphData(learningOutcome);

      PTA_computePrecisionRecall precRec = new PTA_computePrecisionRecall(learned);
      PTATestSequenceEngine engineTestSet = new PTA_FSMStructure(fsm);
      sequenceSet partialPTA = engineTestSet.new sequenceSet();partialPTA.setIdentity();
      partialPTA = partialPTA.cross(testSet);
View Full Code Here

  public static Set<List<String>> trimToNegatives(DirectedSparseGraph g, Collection<List<String>> sMinus ){
    Set<List<String>> returnSet = new HashSet<List<String>>();
    Iterator<List<String>> sMinusIt = sMinus.iterator();
    while(sMinusIt.hasNext()){
      List<String> currentString = sMinusIt.next();
      final FSMStructure expected = getGraphData(g);
      int reject = tracePath(expected, currentString);
      returnSet.add(currentString.subList(0, reject+1));
    }
    return returnSet;
  }
View Full Code Here

    return distancesList.get(distancesList.size()-1).intValue();
  }

  private void populateRandomWalksC(int number, int maxLength){
    int counter=0, unsucc = 0;
    FSMStructure fsm = WMethod.getGraphData(g);
    Random length = new Random(0);
    while(counter<number){
      List<String> path = new ArrayList<String>(maxLength);
      String current = fsm.init;
      if(unsucc>100)
View Full Code Here

    }
  }

  private void populateNegativeRandomWalksC(int number, int maxLength){
    int counter=0, unsucc = 0;
    FSMStructure fsm = WMethod.getGraphData(g);
    Set<String> alphabet = WMethod.computeAlphabet(fsm);
    Random length = new Random(0);
    while(counter<number){
      boolean skip = false;
      List<String> path = new ArrayList<String>(maxLength);
View Full Code Here

TOP

Related Classes of statechum.analysis.learning.TestFSMAlgo.FSMStructure

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.