Package statechum.analysis.learning.observers

Examples of statechum.analysis.learning.observers.Learner


  public static void main(String[] args)
  {
    QSMTool tool = new QSMTool();tool.loadConfig(args[0]);
    if (tool.showLTL)
    {
      Learner l = new RPNIUniversalLearner(null,tool.learnerInitConfiguration);
      LTL_to_ba ba = new LTL_to_ba(tool.learnerInitConfiguration.config);
      if (ba.ltlToBA(tool.learnerInitConfiguration.ifthenSequences, l.init(tool.sPlus, tool.sMinus),true,
          GlobalConfiguration.getConfiguration().getProperty(GlobalConfiguration.G_PROPERTIES.LTL2BA)))
      {
        try
        {
          Visualiser.updateFrame(PathRoutines.convertPairAssociationsToTransitions(Transform.ltlToIfThenAutomaton(ba.getLTLgraph().pathroutines.buildDeterministicGraph()), tool.learnerInitConfiguration.config), null);
View Full Code Here


    {
      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))
View Full Code Here

              }
              else
                innerLearner = new RPNIUniversalLearner(PickNegativesVisualiser.this, conf);// at this point ifthenSequences will always be null.
       
        innerLearner.addObserver(PickNegativesVisualiser.this);
        Learner mainDecorator = new AutoAnswers(innerLearner);
        if (conf.labelDetails != null)
          mainDecorator = new SmtLearnerDecorator(mainDecorator,conf.labelDetails);
            if (whomToNotify != null) whomToNotify.threadStarted();
            LearnerGraph graph = mainDecorator.learnMachine(sPlus, sMinus);
            if (graph != null)
            {
              DirectedSparseGraph learnt = graph.pathroutines.getGraph();
              if(conf.config.isGenerateTextOutput())
                OutputUtil.generateTextOutput(learnt,"textOutput.txt");
View Full Code Here

    for(String [] path:plus)
      assert AbstractOracle.USER_ACCEPTED == expected.paths.tracePathPrefixClosed(Arrays.asList(path));
    for(String [] path:minus)
      assert AbstractOracle.USER_ACCEPTED != expected.paths.tracePathPrefixClosed(Arrays.asList(path));
    // Visualiser.getVisualiser()
    Learner l = new RPNIUniversalLearner(null,new LearnerEvaluationConfiguration(null,null,testConfig,null,null))
    {
      @Override
      public Pair<Integer,String> CheckWithEndUser(
          @SuppressWarnings("unused"LearnerGraph model,
          List<String> question, @SuppressWarnings("unused") int valueForNoRestart,
          @SuppressWarnings("unused") List<Boolean> acceptedElements,
          @SuppressWarnings("unused"final Object [] moreOptions)
      {
        return new Pair<Integer,String>(expected.paths.tracePathPrefixClosed(question),null);
      }
    };
    config.setDebugMode(false);
    //l.setPairsMergedPerHypothesis(0);
    //l.setGeneralisationThreshold(1);
    //l.setCertaintyThreshold(5);
    testConfig.setLearnerIdMode(IDMode.POSITIVE_NEGATIVE);
    LearnerGraph learntStructureA = new LearnerGraph(l.learnMachine(buildSet(plus), buildSet(minus)),expected.config);
    // Now do the same with ptasets instead of real sets
    PTASequenceSet plusPTA = new PTASequenceSet();plusPTA.addAll(buildSet(plus));PTASequenceSet minusPTA = new PTASequenceSet();minusPTA.addAll(buildSet(minus));
    LearnerGraph learntStructureB = new LearnerGraph(l.learnMachine(plusPTA, minusPTA),expected.config);
    Assert.assertNull(WMethod.checkM(learntStructureA, learntStructureB));
    LearnerGraph learntMachineNoRejects = new LearnerGraph(expected.config);
    AbstractPathRoutines.removeRejectStates(learntStructureA,learntMachineNoRejects);
    Assert.assertNull(WMethod.checkM(learntMachineNoRejects, expected));
  }
View Full Code Here

  {
    QSMTool tool = new QSMTool();
                tool.loadConfig(args[0]);
    if (tool.showLTL)
    {
      Learner l = new RPNIUniversalLearner(null,tool.learnerInitConfiguration);
      LTL_to_ba ba = new LTL_to_ba(tool.learnerInitConfiguration.config);
      if (ba.ltlToBA(tool.learnerInitConfiguration.ifthenSequences, l.init(tool.sPlus, tool.sMinus),true,
          GlobalConfiguration.getConfiguration().getProperty(GlobalConfiguration.G_PROPERTIES.LTL2BA)))
      {
        try
        {
                                    LearnerGraph graph = Transform.ltlToIfThenAutomaton(ba.getLTLgraph().pathroutines.buildDeterministicGraph());
View Full Code Here

      config.setMinCertaintyThreshold(2);
      //config.setAskQuestions(false);
      //config.setKlimit(2);
      //config.setLearnerScoreMode(Configuration.ScoreMode.KTAILS);
      config.setLearnerScoreMode(Configuration.ScoreMode.CONVENTIONAL);
      Learner l = new AccuracyTrackerDecorator(new RPNIUniversalLearner(null,new LearnerEvaluationConfiguration(null,null,config,null,null))
      {
        @Override
        public Pair<Integer,String> CheckWithEndUser(
            @SuppressWarnings("unused"LearnerGraph model,
            List<String> question, @SuppressWarnings("unused") int valueForNoRestart,
            @SuppressWarnings("unused") List<Boolean> acceptedElements,
            @SuppressWarnings("unused") final Object [] moreOptions)
        {
          questionNumber.addAndGet(1);
          return new Pair<Integer,String>(graph.paths.tracePathPrefixClosed(question),null);
        }
      }
      , graph);
      sMinus = rpg.getAllSequencesPercentageInterval(1);

      learn(l,sMinus);
      result = result + l.getResult();
    }
View Full Code Here

    final org.w3c.dom.Element nextElement = simulator.expectNextElement(StatechumXML.ELEM_INIT.name());
    final ProgressDecorator.InitialData initial = simulator.readInitialData(nextElement);
    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))
View Full Code Here

              }
              else
                innerLearner = new RPNIUniversalLearner(PickNegativesVisualiser.this, conf);// at this point ltlSequences will always be null.
       
        innerLearner.addObserver(PickNegativesVisualiser.this);
        Learner mainDecorator = new AutoAnswers(innerLearner);
        if (conf.labelDetails != null)
          mainDecorator = new SmtLearnerDecorator(mainDecorator,conf.labelDetails);
            if (whomToNotify != null) whomToNotify.threadStarted();
            DirectedSparseGraph learnt = mainDecorator.learnMachine(sPlus, sMinus).pathroutines.getGraph();
            if(conf.config.isGenerateTextOutput())
              OutputUtil.generateTextOutput(learnt);
            if(conf.config.isGenerateDotOutput())
              OutputUtil.generateDotOutput(learnt);
           
View Full Code Here

    for(String [] path:plus)
      assert AbstractOracle.USER_ACCEPTED == expected.paths.tracePath(Arrays.asList(path));
    for(String [] path:minus)
      assert AbstractOracle.USER_ACCEPTED != expected.paths.tracePath(Arrays.asList(path));
    // Visualiser.getVisualiser()
    Learner l = new RPNIUniversalLearner(null,new LearnerEvaluationConfiguration(null,null,testConfig,null,null))
    {
      @Override
      public Pair<Integer,String> CheckWithEndUser(
          @SuppressWarnings("unused"LearnerGraph model,
          List<String> question, @SuppressWarnings("unused") int valueForNoRestart,
          @SuppressWarnings("unused"final Object [] moreOptions)
      {
        return new Pair<Integer,String>(expected.paths.tracePath(question),null);
      }
    };
    config.setDebugMode(false);
    //l.setPairsMergedPerHypothesis(0);
    //l.setGeneralisationThreshold(1);
    //l.setCertaintyThreshold(5);
    testConfig.setLearnerIdMode(IDMode.POSITIVE_NEGATIVE);
    LearnerGraph learntStructureA = new LearnerGraph(l.learnMachine(buildSet(plus), buildSet(minus)),expected.config);

    // Now do the same with ptasets instead of real sets
    PTASequenceSet plusPTA = new PTASequenceSet();plusPTA.addAll(buildSet(plus));PTASequenceSet minusPTA = new PTASequenceSet();minusPTA.addAll(buildSet(minus));
    LearnerGraph learntStructureB = new LearnerGraph(l.learnMachine(plusPTA, minusPTA),expected.config);
    //Visualiser.updateFrame(learntStructureA, expected);
    Assert.assertNull(WMethod.checkM(learntStructureA, learntStructureB));
    LearnerGraph learntMachineNoRejects = new LearnerGraph(expected.config);
    AbstractPathRoutines.removeRejectStates(learntStructureA,learntMachineNoRejects);
    Assert.assertNull(WMethod.checkM(learntMachineNoRejects, expected));
View Full Code Here

      config.setMinCertaintyThreshold(2);
      //config.setAskQuestions(false);
      //config.setKlimit(2);
      //config.setLearnerScoreMode(Configuration.ScoreMode.KTAILS);
      config.setLearnerScoreMode(Configuration.ScoreMode.CONVENTIONAL);
      Learner l = new AccuracyTrackerDecorator(new RPNIUniversalLearner(null,new LearnerEvaluationConfiguration(null,null,config,null,null))
      {
        @Override
        public Pair<Integer,String> CheckWithEndUser(
            @SuppressWarnings("unused"LearnerGraph model,
            List<String> question, @SuppressWarnings("unused") int valueForNoRestart,
            @SuppressWarnings("unused") final Object [] moreOptions)
        {
          questionNumber.addAndGet(1);
          return new Pair<Integer,String>(graph.paths.tracePath(question),null);
        }
      }
      , graph);
      sMinus = rpg.getAllSequencesPercentageInterval(1);

      learn(l,sMinus);
      result = result + l.getResult();
    }
View Full Code Here

TOP

Related Classes of statechum.analysis.learning.observers.Learner

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.