Package statechum.analysis.learning.observers

Examples of statechum.analysis.learning.observers.LearnerSimulator


   * to compress or uncompress an existing log. 
   */
  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(
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);
    simulator.setNextElement(nextElement);

    Learner learner2 = null;

    if (logFileName.contains(Configuration.LEARNER.LEARNER_BLUEFRINGE_DEC2007.name()))
    {// have to patch the learner.
View Full Code Here

  public static InitialConfigurationAndData loadInitialAndPopulateInitialConfiguration(String argPTAFileName, Configuration configToUse, ConvertALabel converter) throws IOException
  {
    InitialConfigurationAndData outcome = new InitialConfigurationAndData();
   
    final java.io.FileInputStream inputStream = new java.io.FileInputStream(argPTAFileName);
    final LearnerSimulator simulator = new LearnerSimulator(inputStream,true,converter);
    Configuration defaultConfig = configToUse.copy();
    //defaultConfig.setRejectPositivePairsWithScoresLessThan(1);
    assert converter != null : "we expect this methods to be used with large graphs and Array matrix types hence converter must be set";
    outcome.learnerInitConfiguration = simulator.readLearnerConstructionData(defaultConfig);
    outcome.learnerInitConfiguration.setLabelConverter(converter);
   
    final org.w3c.dom.Element nextElement = simulator.expectNextElement(StatechumXML.ELEM_INIT.name());
    outcome.initial = simulator.readInitialData(nextElement);
    inputStream.close();
    return outcome;
  }
View Full Code Here

  @Test
  public void runCompareTwoLearners() throws IOException
    {
    final Configuration.STATETREE trTypeFinal = Configuration.STATETREE.STATETREE_LINKEDHASH;
    final java.io.FileInputStream inputStream = new java.io.FileInputStream(largePTAFileName);
    final LearnerSimulator simulator = new LearnerSimulator(inputStream,true);
    Configuration defaultConfig = Configuration.getDefaultConfiguration();
    PaperUAS paper = new PaperUAS();
    paper.learnerInitConfiguration = simulator.readLearnerConstructionData(defaultConfig);
    final org.w3c.dom.Element nextElement = simulator.expectNextElement(StatechumXML.ELEM_INIT.name());
    final ProgressDecorator.InitialData initial = simulator.readInitialData(nextElement);
    inputStream.close();

    Configuration learnerConf = paper.learnerInitConfiguration.config.copy();learnerConf.setTransitionMatrixImplType(trTypeFinal);
        FileReader listOptReader = new FileReader(largePTALogsDir+pairsToUse);
        List<PairOfPaths> listOpt=PairOfPaths.readPairs(listOptReader, paper.learnerInitConfiguration.config);
View Full Code Here

   * to compress or uncompress an existing log. 
   */
  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(
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.
View Full Code Here

  public void copyLogIntoAnotherLog(String logFileName)
  {
    try {
      Configuration config = Configuration.getDefaultConfiguration().copy();
      final java.io.FileInputStream inputStream = new java.io.FileInputStream(logFileName);
      final LearnerSimulator simulator = new LearnerSimulator(inputStream,true);
      final LearnerEvaluationConfiguration evalData = simulator.readLearnerConstructionData(config);
      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(
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 java.io.FileInputStream inputStream = new java.io.FileInputStream(logFileName);
    final LearnerSimulator simulator = new LearnerSimulator(inputStream,true);
    Configuration config = Configuration.getDefaultConfiguration().copy();
    config.setLegacyXML(true);
    final LearnerEvaluationConfiguration evalData = simulator.readLearnerConstructionData(config);
    evalData.config.setTransitionMatrixImplType(STATETREE.STATETREE_SLOWTREE);
   
    // 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.
View Full Code Here

  public void copyLogIntoAnotherLog(String logFileName)
  {
    try {
      Configuration config = Configuration.getDefaultConfiguration().copy();
      final java.io.FileInputStream inputStream = new java.io.FileInputStream(logFileName);
      final LearnerSimulator simulator = new LearnerSimulator(inputStream,true,null);// not using a converter
      final LearnerEvaluationConfiguration evalData = simulator.readLearnerConstructionData(config);
      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(
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 java.io.FileInputStream inputStream = new java.io.FileInputStream(logFileName);
    final LearnerSimulator simulator = new LearnerSimulator(inputStream,true,null);
    Configuration config = Configuration.getDefaultConfiguration().copy();
    config.setLegacyXML(true);
    final LearnerEvaluationConfiguration evalData = simulator.readLearnerConstructionData(config);
    evalData.config.setTransitionMatrixImplType(STATETREE.STATETREE_SLOWTREE);
   
    // 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).
    evalData.config.setScoreCompatibilityScoreComputationBugEmulation(true);
    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.
View Full Code Here

TOP

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

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.