Package statechum.model.testset

Examples of statechum.model.testset.PTASequenceEngine


    System.out.println(pr.getPosprecision()+", "+pr.getPosrecall()+", "+pr.getNegprecision()+", "+pr.getNegrecall());
  }
 
  public static PosNegPrecisionRecall compare(LearnerGraph specfsm, LearnerGraph imp){
    PTA_computePrecisionRecall precRec = new PTA_computePrecisionRecall(imp);
    PTASequenceEngine engine = new PTA_FSMStructure(specfsm,null);
    SequenceSet partialPTA = engine.new SequenceSet();partialPTA.setIdentity();
    partialPTA = partialPTA.cross(specfsm.wmethod.getFullTestSet(1));
    precRec.crossWith(engine);return precRec.getPosNegPrecisionRecallNum();
  }
View Full Code Here


    precRec.crossWith(engine);return precRec.getPosNegPrecisionRecallNum();
  }
 
  public static PosNegPrecisionRecall compare(Collection<List<String>> tests, LearnerGraph specfsm, LearnerGraph imp){
    PTA_computePrecisionRecall precRec = new PTA_computePrecisionRecall(imp);
    PTASequenceEngine engine = new PTA_FSMStructure(specfsm,null);
    SequenceSet partialPTA = engine.new SequenceSet();partialPTA.setIdentity();
    partialPTA = partialPTA.cross(tests);
    precRec.crossWith(engine);return precRec.getPosNegPrecisionRecallNum();
  }
View Full Code Here

    return outcome;
  }
 
  public LearnerGraph learn(PTASequenceEngine engineArg, boolean useNegatives)
  {
    PTASequenceEngine engine = null;
    if (!useNegatives)
    {
      PTASequenceEngine positives = new PTASequenceEngine();positives.init(new Automaton());
      SequenceSet initSeq = positives.new SequenceSet();initSeq.setIdentity();
      initSeq.cross(engineArg.getData());
      engine = positives;
    }
    else
View Full Code Here

      {
        theOnlyStateReject = true;break;
      }
    final Boolean rejectAllStates = new Boolean(theOnlyStateReject);
    final AtomicBoolean statesAccept = new AtomicBoolean(true);
    PTASequenceEngine allSequences = new PTASequenceEngine();
    allSequences.init(new PTASequenceSetAutomaton()
    {
      @Override
      public Object getTheOnlyState() {
        return statesAccept.get()?accept:reject;
      }
View Full Code Here

    try
    {
      Configuration config = (Configuration)Configuration.getDefaultConfiguration().clone();
      RPNIBlueFringeLearnerTestComponentOpt l = new RPNIBlueFringeLearnerTestComponentOpt(null,config);
      config.setLearnerIdMode(Configuration.IDMode.POSITIVE_NEGATIVE);
      PTASequenceEngine engine = buildPTA(plusStrings, minusStrings);
      checkPTAConsistency(engine, plusStrings, true);if (engine.numberOfLeafNodes()>0) checkPTAConsistency(engine, minusStrings, false);
      l.init(engine,0,0);
      actualD = l.scoreComputer.paths.getGraph();
    }
    catch(IllegalArgumentException e)
    {
View Full Code Here

    try
    {
      Configuration config = (Configuration)Configuration.getDefaultConfiguration().clone();
      RPNIBlueFringeLearnerTestComponentOpt l = new RPNIBlueFringeLearnerTestComponentOpt(null,config);
      config.setLearnerIdMode(Configuration.IDMode.POSITIVE_NEGATIVE);
      PTASequenceEngine engine = buildPTA(plusStrings, minusStrings);
      checkPTAConsistency(engine, plusStrings, true);if (engine.numberOfLeafNodes()>0) checkPTAConsistency(engine, minusStrings, false);
      l.init(engine,0,0);
      actualD = l.scoreComputer.paths.getGraph();
    }
    catch(IllegalArgumentException e)
    {
View Full Code Here

          @SuppressWarnings("unused") final Object [] moreOptions)
      {
        return new Pair<Integer,String>(graph.paths.tracePath(question),null);
      }
    };
    PTASequenceEngine sPlus = null, sMinus = null;int percent = 10;
    sPlus = rpg.getExtraSequences(percent/10-1);sMinus = rpg.getAllSequences(percent/10-1);

    int ptaSize = sMinus.numberOfLeafNodes();
    l.init(sMinus, ptaSize,ptaSize);// our imaginary positives are prefixes of negatives.
    DirectedSparseGraph learningOutcome = l.learnMachine();
    l.setQuestionCounter(0);
    LearnerGraph learned = new LearnerGraph(learningOutcome,config);
    PTA_computePrecisionRecall precRec = new PTA_computePrecisionRecall(learned);
    PTASequenceEngine engine = new PTA_FSMStructure(graph);
    precRec.crossWith(sMinus);
    SequenceSet ptaTestSet = engine.new SequenceSet();ptaTestSet.setIdentity();
    ptaTestSet = ptaTestSet.cross(graph.wmethod.getFullTestSet(1));
    PosNegPrecisionRecall prNeg = precRec.crossWith(engine);
    System.out.println("pre: "+prNeg.getPrecision()+" rec: "+prNeg.getRecall());
View Full Code Here

  
   /** Records the initial PTA. The Pta from the paper is recorded as the initial automaton and the automaton passed as an argument is recorded as the expected outcome of learning of the evaluation configuration.
    */
   public void recordInitialConfiguration(LearnerGraph smallPTA) throws IOException
   {
       PTASequenceEngine engine = collectionOfTraces.get(UAVAllSeeds).tracesForUAVandFrame.get(UAVAllSeeds).get(maxFrameNumber);
      
       FileOutputStream log = new java.io.FileOutputStream("resources/largePTA/VeryLargePTA.zip");
       RPNIBlueFringeVariability ourLearner = new RPNIBlueFringeVariability(learnerInitConfiguration,true,null,null);
       LearnerGraph automatonAfterInit = ourLearner.getLearner().init(engine,0,0);
       final Configuration shallowCopy = automatonAfterInit.config.copy();shallowCopy.setLearnerCloneGraph(false);
View Full Code Here

      {
        theOnlyStateReject = true;break;
      }
    final Boolean rejectAllStates = new Boolean(theOnlyStateReject);
    final AtomicBoolean statesAccept = new AtomicBoolean(true);
    PTASequenceEngine allSequences = new PTASequenceEngine();
   
    // Here we are building a PTA which consists of accept states for plusStrings and reject-states
    // for minusStrings. This way if a plus string is a prefix of a plusString, the prefix will
    // be labelled with Boolean(true) states and the suffix - with Boolean(false) states.
    // Note that the suffix may contain many states.
    allSequences.init(new PTASequenceSetAutomaton()
    {
      @Override
      public Object getTheOnlyState() {
        return statesAccept.get()?accept:reject;
      }
View Full Code Here

    try
    {
      Configuration config = mainConfiguration.copy();
      RPNIUniversalLearner l = new RPNIUniversalLearner(null,new LearnerEvaluationConfiguration(null,null,config,null,null));
      config.setLearnerIdMode(Configuration.IDMode.POSITIVE_NEGATIVE);
      PTASequenceEngine engine = buildPTA(plusStrings, minusStrings);
      checkPTAConsistency(engine, plusStrings, true);if (engine.numberOfLeafNodes()>0) checkPTAConsistency(engine, minusStrings, false);
      l.init(engine,0,0);
      actualD = l.getTentativeAutomaton().pathroutines.getGraph();
    }
    catch(IllegalArgumentException e)
    {
View Full Code Here

TOP

Related Classes of statechum.model.testset.PTASequenceEngine

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.