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);
    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 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

  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

  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

*
*/
public class Test_CheckLearnerAgainstLog {
  public void check(String logFileName) throws FileNotFoundException
  {
    final LearnerSimulator simulator = new LearnerSimulator(new java.io.FileInputStream(logFileName),true);
    final LearnerEvaluationConfiguration eval1 = simulator.readLearnerConstructionData();
    final org.w3c.dom.Element nextElement = simulator.expectNextElement(ELEM_KINDS.ELEM_INIT.name());
    final ProgressDecorator.InitialData initial = simulator.readInitialData(nextElement);
    simulator.setNextElement(nextElement);
    RPNIBlueFringeLearner learner2 = new RPNIBlueFringeLearnerTestComponentOpt(null,eval1.config)
    {
      @Override
      public Pair<Integer,String> checkWithEndUser(
          @SuppressWarnings("unused"LearnerGraph model,
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

  {// this part is nested in order to ensure that an instance of LearnerSimulator
   // goes out of scope and is garbage collected as soon as possible. It holds a great deal
   // of Xerces objects used for recording execution traces that is not used in this test but takes
   // a lot of memory.
    final java.io.FileInputStream inputStream = new java.io.FileInputStream(argPTAFileName);
    final LearnerSimulator simulator = new LearnerSimulator(inputStream,true,converter);
    Configuration defaultConfig = Configuration.getDefaultConfiguration().copy();
    paper.learnerInitConfiguration = simulator.readLearnerConstructionData(defaultConfig);
    paper.learnerInitConfiguration.setLabelConverter(converter);
    final org.w3c.dom.Element nextElement = simulator.expectNextElement(StatechumXML.ELEM_INIT.name());
    ProgressDecorator.InitialData initial = simulator.readInitialData(nextElement);
    inputStream.close();
    return initial;
  }
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.