Examples of RPNIUniversalLearner


Examples of statechum.analysis.learning.RPNIUniversalLearner

      int size = 2*graph.pathroutines.countEdges();
      RandomPathGenerator rpg = new RandomPathGenerator(graph, new Random(100),5,null);// the seed for Random should be the same for each file
      int percentPerChunk = 10;
      int nrPerChunk = size/(100/percentPerChunk);nrPerChunk+=nrPerChunk % 2;// make the number even
      rpg.generatePosNeg(2*nrPerChunk , 100/percentPerChunk);// 2* reflects the fact that nrPerChunk denotes the number of elements in both chunks (positive and negative) combined.  */
      RPNILearner learner = 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,
View Full Code Here

Examples of statechum.analysis.learning.RPNIUniversalLearner

    //"B-e->A\nC-e->A\nD-e->A\nE-e->A\nF-e->A\nG-e->A\n","testAutoAnswers0"),Configuration.getDefaultConfiguration()),null);
    Configuration testConfig = Configuration.getDefaultConfiguration().copy();
    testConfig.setGdFailOnDuplicateNames(false);
    testConfig.setLearnerIdMode(IDMode.POSITIVE_NEGATIVE);

    RPNILearner learner = 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 responseForNoRestart,
View Full Code Here

Examples of statechum.analysis.learning.RPNIUniversalLearner

    final AutoAnswers semiUser = new AutoAnswers(null);
    semiUser.loadAnswers(new StringReader(
        partA
    ));
   
    RPNILearner learner = 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 responseForNoRestart,
View Full Code Here

Examples of statechum.analysis.learning.RPNIUniversalLearner

  {
    Configuration testConfig = Configuration.getDefaultConfiguration().copy();
    testConfig.setGdFailOnDuplicateNames(false);
    testConfig.setLearnerIdMode(IDMode.POSITIVE_NEGATIVE);

    RPNILearner learner = new RPNIUniversalLearner(null,new LearnerEvaluationConfiguration(null,null,testConfig,null,null))
    {
      @Override
      public Pair<Integer,String> CheckWithEndUser(
          @SuppressWarnings("unused"LearnerGraph model,
          @SuppressWarnings("unused"List<String> question, @SuppressWarnings("unused") int responseForNoRestart,
View Full Code Here

Examples of statechum.analysis.learning.RPNIUniversalLearner

    // now sanity checking on the plus and minus sets
    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));
    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 responseForNoRestart,
          @SuppressWarnings("unused") List<Boolean> acceptedElements,
          @SuppressWarnings("unused") PairScore pairBeingMerged,
          @SuppressWarnings("unused"final Object [] moreOptions)
      {
        return new Pair<Integer,String>(expected.paths.tracePathPrefixClosed(question),null);
      }
    };
    testConfig.setLearnerIdMode(IDMode.POSITIVE_NEGATIVE);
    ByteArrayOutputStream logStream = new ByteArrayOutputStream();
    RecordProgressDecorator recorder = new RecordProgressDecorator(l,logStream,1,testConfig,useZip);
    Collection<List<String>> testSet = new LinkedList<List<String>>();
    recorder.writeLearnerEvaluationData(new LearnerEvaluationConfiguration(expected, testSet, testConfig, null, null));
    LearnerGraph learntStructureA = recorder.learnMachine(buildSet(plus), buildSet(minus));
   
    //System.out.println("compression rate: "+recorder.getCompressionRate());
    //System.out.println(logStream.toString()+"============");
    //System.out.println(logStream.toByteArray().length);
    LearnerGraph learntMachineNoRejects = new LearnerGraph(testConfig);
    AbstractPathRoutines.removeRejectStates(learntStructureA,learntMachineNoRejects);
    Assert.assertNull(WMethod.checkM(learntMachineNoRejects, expected));
   
    switch(kind)
    {
      case RECORDERTEST_SS:
      {// matching two simulators
        final LearnerSimulator
          simulator = new LearnerSimulator(new ByteArrayInputStream(logStream.toByteArray()),useZip),
          simulator2 = new LearnerSimulator(new ByteArrayInputStream(logStream.toByteArray()),useZip);
       
        LearnerEvaluationConfiguration eval1 = simulator.readLearnerConstructionData();
        Assert.assertNull(WMethod.checkM(expected, eval1.graph));
        Assert.assertEquals(testSet, eval1.testSet);
        Assert.assertEquals(expected.config, testConfig);
        LearnerEvaluationConfiguration eval2 = simulator2.readLearnerConstructionData();
        Assert.assertNull(WMethod.checkM(expected, eval2.graph));
        Assert.assertEquals(testSet, eval2.testSet);
        Assert.assertEquals(expected.config, testConfig);
       
        new Test_LearnerComparator(simulator,simulator2,true).learnMachine(buildSet(plus), buildSet(minus));
        break;
      }
     
      case RECORDERTEST_SL:
      {// now a simulator to a learner
        final LearnerSimulator simulator = new LearnerSimulator(new ByteArrayInputStream(logStream.toByteArray()),useZip);
        LearnerEvaluationConfiguration eval1 = simulator.readLearnerConstructionData();
        Assert.assertNull(WMethod.checkM(expected, eval1.graph));
        Assert.assertEquals(testSet, eval1.testSet);
        Assert.assertEquals(expected.config, testConfig);
 
        Learner learner2 = new RPNIUniversalLearner(null,new LearnerEvaluationConfiguration(null,null,expected.config,null,null))
        {
          @Override
          public Pair<Integer,String> CheckWithEndUser(
              @SuppressWarnings("unused"LearnerGraph model,
              List<String> question, @SuppressWarnings("unused") int responseForNoRestart,
              @SuppressWarnings("unused") List<Boolean> acceptedElements,
              @SuppressWarnings("unused") PairScore pairBeingMerged,
              @SuppressWarnings("unused"final Object [] moreOptions)
          {
            return new Pair<Integer,String>(expected.paths.tracePathPrefixClosed(question),null);
          }
        };
        new Test_LearnerComparator(learner2,simulator,true).learnMachine(buildSet(plus), buildSet(minus));
        break;
      }

      case RECORDERTEST_LL:
      {// now two learners
        Learner learnerA = 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 responseForNoRestart,
              @SuppressWarnings("unused") List<Boolean> acceptedElements,
              @SuppressWarnings("unused") PairScore pairBeingMerged,
              @SuppressWarnings("unused"final Object [] moreOptions)
          {
            return new Pair<Integer,String>(expected.paths.tracePathPrefixClosed(question),null);
          }
        };
        Learner learnerB = 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 responseForNoRestart,
View Full Code Here

Examples of statechum.analysis.learning.RPNIUniversalLearner

      int size = 2*graph.pathroutines.countEdges();
      RandomPathGenerator rpg = new RandomPathGenerator(graph, new Random(100),5,null);// the seed for Random should be the same for each file
      int percentPerChunk = 10;
      int nrPerChunk = size/(100/percentPerChunk);nrPerChunk+=nrPerChunk % 2;// make the number even
      rpg.generatePosNeg(2*nrPerChunk , 100/percentPerChunk);// 2* reflects the fact that nrPerChunk denotes the number of elements in both chunks (positive and negative) combined.  */
      RPNILearner learner = 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,
View Full Code Here

Examples of statechum.analysis.learning.RPNIUniversalLearner

    //"B-e->A\nC-e->A\nD-e->A\nE-e->A\nF-e->A\nG-e->A\n","testAutoAnswers0"),Configuration.getDefaultConfiguration()),null);
    Configuration testConfig = Configuration.getDefaultConfiguration().copy();
    testConfig.setGdFailOnDuplicateNames(false);
    testConfig.setLearnerIdMode(IDMode.POSITIVE_NEGATIVE);

    RPNILearner learner = new RPNIUniversalLearner(null,new LearnerEvaluationConfiguration(null,null,testConfig,null,null))
    {
      @Override
      public Pair<Integer,String> CheckWithEndUser(
          @SuppressWarnings("unused"LearnerGraph model,
          List<Label> question, @SuppressWarnings("unused") int responseForNoRestart,
View Full Code Here

Examples of statechum.analysis.learning.RPNIUniversalLearner

    final AutoAnswers semiUser = new AutoAnswers(null);
    semiUser.loadAnswers(new StringReader(
        partA
    ),testConfig);
   
    RPNILearner learner = new RPNIUniversalLearner(null,new LearnerEvaluationConfiguration(null,null,testConfig,null,null))
    {
      @Override
      public Pair<Integer,String> CheckWithEndUser(
          @SuppressWarnings("unused"LearnerGraph model,
          List<Label> question, @SuppressWarnings("unused") int responseForNoRestart,
View Full Code Here

Examples of statechum.analysis.learning.RPNIUniversalLearner

  {
    Configuration testConfig = Configuration.getDefaultConfiguration().copy();
    testConfig.setGdFailOnDuplicateNames(false);
    testConfig.setLearnerIdMode(IDMode.POSITIVE_NEGATIVE);

    RPNILearner learner = new RPNIUniversalLearner(null,new LearnerEvaluationConfiguration(null,null,testConfig,null,null))
    {
      @Override
      public Pair<Integer,String> CheckWithEndUser(
          @SuppressWarnings("unused"LearnerGraph model,
          @SuppressWarnings("unused"List<Label> question, @SuppressWarnings("unused") int responseForNoRestart,
View Full Code Here

Examples of statechum.analysis.learning.RPNIUniversalLearner

  {
    Configuration testConfig = Configuration.getDefaultConfiguration().copy();
    testConfig.setGdFailOnDuplicateNames(false);
    testConfig.setLearnerIdMode(IDMode.POSITIVE_NEGATIVE);

    RPNILearner learner = new RPNIUniversalLearner(null,new LearnerEvaluationConfiguration(null,null,testConfig,null,null))
    {
      @Override
      public Pair<Integer,String> CheckWithEndUser(
          @SuppressWarnings("unused"LearnerGraph model,
          @SuppressWarnings("unused"List<Label> question, @SuppressWarnings("unused") int responseForNoRestart,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.