Package statechum.analysis.learning.observers.ProgressDecorator

Examples of statechum.analysis.learning.observers.ProgressDecorator.LearnerEvaluationConfiguration


          }
        }
      }
      while(pickUniqueFromInitial && uniqueFromInitial == null);
     
      LearnerEvaluationConfiguration learnerEval = new LearnerEvaluationConfiguration(config);learnerEval.setLabelConverter(converter);
      final Collection<List<Label>> testSet = PaperUAS.computeEvaluationSet(referenceGraph,states*3,states*alphabet);
     
      for(int attempt=0;attempt<2;++attempt)
      {// try learning the same machine a few times
        LearnerGraph pta = new LearnerGraph(config);
View Full Code Here


   */
  public void copyLogIntoAnotherLog(String logFileName)
  {
    try {
      final LearnerSimulator simulator = new LearnerSimulator(new java.io.FileInputStream(logFileName),true);
      final LearnerEvaluationConfiguration evalData = simulator.readLearnerConstructionData();
      final org.w3c.dom.Element nextElement = simulator.expectNextElement(StatechumXML.ELEM_INIT.name());
      final ProgressDecorator.InitialData initial = simulator.readInitialData(nextElement);
      simulator.setNextElement(nextElement);
 
      RPNILearner learner2 = new RPNIUniversalLearner(null,new LearnerEvaluationConfiguration(null,null,evalData.config,null,null))
      {
        @Override
        public Pair<Integer,String> CheckWithEndUser(
            @SuppressWarnings("unused"LearnerGraph model,
            List<String> question,  @SuppressWarnings("unused") int answerForNoRestart,
View Full Code Here

    // now a simulator to a learner
    if (logFileName.contains(Configuration.LEARNER.LEARNER_BLUEFRINGE_DEC2007.name()))
      VertexID.comparisonKind = ComparisonKind.COMPARISON_LEXICOGRAPHIC_ORIG;// this is a major change in a configuration of learners, affecting the comparison between vertex IDs

    final LearnerSimulator simulator = new LearnerSimulator(new java.io.FileInputStream(logFileName),true);
    final LearnerEvaluationConfiguration evalData = simulator.readLearnerConstructionData();

    // Now we need to choose learner parameters based on the kind of file we are given
    // (given the pace of Statechum evolution, I cannot expect all the correct options
    // to be stored in log files).
    if (logFileName.contains(Configuration.LEARNER.LEARNER_BLUEFRINGE_MAY2008.name()))
    {
      evalData.config.setUseAmber(false);evalData.config.setUseLTL(false);
      evalData.config.setSpeculativeQuestionAsking(false);
      evalData.config.setIgnoreDepthInTheChoiceOfRepresentatives(true);evalData.config.setIgnoreVertexAttributesInLogReplay(true);
    }
    else    
      if (logFileName.contains(Configuration.LEARNER.LEARNER_BLUEAMBER_MAY2008.name()))
      {
        evalData.config.setUseAmber(true);evalData.config.setUseLTL(false);
        evalData.config.setSpeculativeQuestionAsking(false);
        evalData.config.setIgnoreDepthInTheChoiceOfRepresentatives(true);evalData.config.setIgnoreVertexAttributesInLogReplay(true);
      }
      else
        if (logFileName.contains(Configuration.LEARNER.LEARNER_BLUEFRINGE_DEC2007.name()))
        {// we'd like to make sure that the initial configuration is loaded with the correct configuration values.
          evalData.config.setInitialIDvalue(1);
          VertexID.comparisonKind = ComparisonKind.COMPARISON_LEXICOGRAPHIC_ORIG;
          evalData.config.setUseAmber(false);evalData.config.setUseLTL(false);
          evalData.config.setSpeculativeQuestionAsking(false);
          evalData.config.setDefaultInitialPTAName("Init");
          evalData.config.setIgnoreDepthInTheChoiceOfRepresentatives(true);evalData.config.setIgnoreVertexAttributesInLogReplay(true);
        }
        else
          Assert.fail("unknown type of log file");

    final org.w3c.dom.Element nextElement = simulator.expectNextElement(StatechumXML.ELEM_INIT.name());
    final ProgressDecorator.InitialData initial = simulator.readInitialData(nextElement);
    if (evalData.labelDetails != null)
    {
      initial.plus.addAll(evalData.labelDetails.getSPlus());initial.minus.addAll(evalData.labelDetails.getSMinus());
    }
    simulator.setNextElement(nextElement);

    Learner learner2 = null;

    if (logFileName.contains(Configuration.LEARNER.LEARNER_BLUEFRINGE_DEC2007.name()))
    {// have to patch the learner.
     
      learner2 = new RPNIUniversalLearner(null,new LearnerEvaluationConfiguration(null,null,evalData.config,null,null))
      {
        /* (non-Javadoc)
         * @see statechum.analysis.learning.observers.DummyLearner#init(java.util.Collection, java.util.Collection)
         */
        @Override
        public LearnerGraph init(Collection<List<String>> plus,  Collection<List<String>> minus)
        {
          return super.init(plus, minus);
        }

        /* (non-Javadoc)
         * @see statechum.analysis.learning.RPNIUniversalLearner#ComputeQuestions(statechum.analysis.learning.PairScore, statechum.analysis.learning.rpnicore.LearnerGraph, statechum.analysis.learning.rpnicore.LearnerGraph)
         */
        @Override
        public List<List<String>> ComputeQuestions(PairScore pair,  LearnerGraph original, LearnerGraph tempNew)
        {
          return ArrayOperations.sort(ComputeQuestions.computeQS_origReduced(pair,original,tempNew));
        }

        /* (non-Javadoc)
         * @see statechum.analysis.learning.RPNIUniversalLearner#MergeAndDeterminize(statechum.analysis.learning.rpnicore.LearnerGraph, statechum.analysis.learning.StatePair)
         */
        @Override
        public LearnerGraph MergeAndDeterminize(LearnerGraph original,  StatePair pair)
        {
          return MergeStates.mergeAndDeterminize(original,pair);
        }
       
        @Override
        public Pair<Integer,String> CheckWithEndUser(
            @SuppressWarnings("unused"LearnerGraph model,
            List<String> question, @SuppressWarnings("unused") int answerForNoRestart,
            @SuppressWarnings("unused") List<Boolean> acceptedElements,
            @SuppressWarnings("unused"final Object [] moreOptions)
          {
            return new Pair<Integer,String>(evalData.graph.paths.tracePathPrefixClosed(question),null);
          }
       
        @Override
        public void AugumentPTA_and_QuestionPTA(LearnerGraph pta, RestartLearningEnum ptaKind,
            List<String> sequence, boolean accepted, JUConstants newColour)
        {
          topLevelListener.AugmentPTA(pta, ptaKind, sequence, accepted, newColour);
        }
      };
       
    }
    else
    if (logFileName.contains(Configuration.LEARNER.LEARNER_BLUEFRINGE_MAY2008.name()) ||
        logFileName.contains(Configuration.LEARNER.LEARNER_BLUEAMBER_MAY2008.name())
     )
    {// have to patch the learner.
     
      learner2 = new RPNIUniversalLearner(null,new LearnerEvaluationConfiguration(null,null,evalData.config,null,null))
      {
        /* (non-Javadoc)
         * @see statechum.analysis.learning.observers.DummyLearner#init(java.util.Collection, java.util.Collection)
         */
        @Override
 
View Full Code Here

   */
  public RPNIBlueFringeVariability(final LearnerEvaluationConfiguration evaluationConfiguration, boolean optimisedMerge, final List<PairOfPaths> lw, final List<PairOfPaths> lc)
  {
    listOfPairsToWrite = lw;useOptimizedMerge = optimisedMerge;
    if (lc != null) listOfPairsToCheckAgainstIterator = lc.iterator();else listOfPairsToCheckAgainstIterator = null;
    final LearnerEvaluationConfiguration bfLearnerInitConfiguration = new LearnerEvaluationConfiguration(evaluationConfiguration.config);
    bfLearnerInitConfiguration.ifthenSequences = evaluationConfiguration.ifthenSequences;
    bfLearnerInitConfiguration.setLabelConverter(evaluationConfiguration.getLabelConverter());
    config = bfLearnerInitConfiguration.config;// our config is a copy of the one supplied as an argument.
    config.setAskQuestions(false);
    learner = new DummyLearner(new RPNIUniversalLearner(null, bfLearnerInitConfiguration))
    {
     
View Full Code Here

      LearnerGraph referenceGraph = null;
      ThreadResult outcome = new ThreadResult();
      MachineGenerator mg = new MachineGenerator(states, 400 , (int)Math.round((double)states/5));mg.setGenerateConnected(true);
      referenceGraph = mg.nextMachine(alphabet,seed, config, converter).pathroutines.buildDeterministicGraph();// reference graph has no reject-states, because we assume that undefined transitions lead to reject states.
     
      LearnerEvaluationConfiguration learnerEval = new LearnerEvaluationConfiguration(config);learnerEval.setLabelConverter(converter);
      final Collection<List<Label>> testSet = PaperUAS.computeEvaluationSet(referenceGraph,states*3,makeEven(states*tracesAlphabet));

      for(int attempt=0;attempt<2;++attempt)
      {// try learning the same machine a few times
        LearnerGraph pta = new LearnerGraph(config);
View Full Code Here

      LearnerGraph referenceGraph = null;
      ThreadResult outcome = new ThreadResult();
      MachineGenerator mg = new MachineGenerator(states, 400 , (int)Math.round((double)states/5));mg.setGenerateConnected(true);
      referenceGraph = mg.nextMachine(alphabet,seed, config, converter).pathroutines.buildDeterministicGraph();// reference graph has no reject-states, because we assume that undefined transitions lead to reject states.
     
      LearnerEvaluationConfiguration learnerEval = new LearnerEvaluationConfiguration(config);learnerEval.setLabelConverter(converter);
      final Collection<List<Label>> testSet = PaperUAS.computeEvaluationSet(referenceGraph,states*3,makeEven(states*alphabet));

      for(int attempt=0;attempt<2;++attempt)
      {// try learning the same machine a few times
        LearnerGraph pta = new LearnerGraph(config);
View Full Code Here

  public static class KTailsReferenceLearner extends LearnerThatCanClassifyPairs
  {
    private static LearnerEvaluationConfiguration constructConfiguration(LearnerEvaluationConfiguration evalCnf, boolean allPaths, int k)
    {
      Configuration config = evalCnf.config.copy();config.setLearnerScoreMode(allPaths? Configuration.ScoreMode.KTAILS:Configuration.ScoreMode.KTAILS_ANY);config.setKlimit(k);
      LearnerEvaluationConfiguration copy = new LearnerEvaluationConfiguration(config);
      copy.graph = evalCnf.graph;copy.testSet = evalCnf.testSet;
      copy.setLabelConverter(evalCnf.getLabelConverter());
      copy.ifthenSequences = evalCnf.ifthenSequences;copy.labelDetails=evalCnf.labelDetails;
      return copy;
    }
View Full Code Here

          }
        }
      }
      while(pickUniqueFromInitial && uniqueFromInitial == null);
     
      LearnerEvaluationConfiguration learnerEval = new LearnerEvaluationConfiguration(config);learnerEval.setLabelConverter(converter);
      final Collection<List<Label>> testSet = null;//PaperUAS.computeEvaluationSet(referenceGraph,states*3,states*alphabet);
     
      for(int attempt=0;attempt<2;++attempt)
      {// try learning the same machine a few times
        LearnerGraph pta = new LearnerGraph(config);
View Full Code Here

    for(String [] path:plus)
      assert AbstractOracle.USER_ACCEPTED == expected.paths.tracePathPrefixClosed(AbstractLearnerGraph.buildList(Arrays.asList(path),config,getLabelConverter()));
    for(String [] path:minus)
      assert AbstractOracle.USER_ACCEPTED != expected.paths.tracePathPrefixClosed(AbstractLearnerGraph.buildList(Arrays.asList(path),config,getLabelConverter()));
    // Visualiser.getVisualiser()
    Learner l = new RPNIUniversalLearner(null,new LearnerEvaluationConfiguration(null,null,testConfig,null,null))
    {
      @Override
      public LearnerGraph MergeAndDeterminize(LearnerGraph original, StatePair pair)
      {
        // Check that compatibility score computation gives the same response as if we did merge and computed a difference between the number of states.
View Full Code Here

      QSMTool.cmdOperation+" "+"B"+" "+LabelRepresentation.OP_DATA.POST+ " somePostcondB"}));

    ByteArrayOutputStream output = new ByteArrayOutputStream();
    RecordProgressDecorator dumper = new RecordProgressDecorator(null,output,1,Configuration.getDefaultConfiguration(),false);
    dumper.topElement.appendChild(dumper.writeLearnerEvaluationConfiguration(
        new LearnerEvaluationConfiguration(graph,testData,config,ltl,labels)));dumper.close();
   
    xmlData = output.toString();
  }
View Full Code Here

TOP

Related Classes of statechum.analysis.learning.observers.ProgressDecorator.LearnerEvaluationConfiguration

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.