Skip to content

Training.json Specifications

DannyWeitekamp edited this page Jul 25, 2019 · 3 revisions

Training.json Specifications

A Training.json file specifies a set of Apprentice Learner agents and the problems they will do. This configuration file can be fed into train.py in order to batch train a set of agents.

{
 "set_params" : {"README" : "You can set parameters at the file level. These will stick around while this .json is running except for when they are overriden"},

 "training_set1" : [

Training files are broken up into training sets. Training sets consist of a list of agents that will be trained. At the training set level "set_params" be set to apply parameters to all subsequent training sets. Setting repetitions at this level will train the same agent several times.

 {
  "agent_name": "my_AL_agent",
  "agent_type": "ModularAgent",
  "stay_active": true,
  "dont_save": true,
  "no_ops_parse": true,
  "args": {
    "when_learner": "trestle",
    "where_learner": "MostSpecific",
    "planner": "fo_planner"
  },
  "feature_set": [
    "equals"
  ],
  "function_set": [
    "add",
    "subtract",
    "multiply",
    "divide"
  ],
  "set_params": {
        "HTML": "HTML/fraction_arithmetic.html",
        "examples_only": false
    },
  "repetitions" : 5,
  "outer_loop_controller" : "Random",
  "problem_set" : [

At the agent level, many parameters can be set that control the type and behavior of a particular agent. Using "set_params" at this level will set parameters which persist for that particular agent and all of the problems at the problem level

   {"set_params" : 
    {"README" : "You can also set parameters at the agent level. These will stick around for just this agent. And override file level parameters.",
    "HTML": "IntegerArithmetic/HTML/IntegerArithmetic.html",
    "examples_only" : true}
   },

    {"README" : "Problem level parameters will override everything else. But only apply to this problem.",
    "question_file" : "../FinalBRDs/1+1.brd"},
    {"question_file" : "../FinalBRDs/2+1.brd"},
    {"question_file" : "../FinalBRDs/2+2.brd"},
    {"question_file" : "../FinalBRDs/3+4.brd"},
    {"question_file" : "../FinalBRDs/3+5.brd"},
    {"question_file" : "../FinalBRDs/4+3.brd"},
    {"question_file" : "../FinalBRDs/6+9.brd"},
    {"question_file" : "../FinalBRDs/8+7.brd"},

    {"README" : "We can also set the number of repetitions for a problem. Default 1. <= 0, nothing happens",
    "question_file" : "../FinalBRDs/9+2.brd",
    "repetitions":7},

    {"set_params" : 
    {"HTML": "FractionArithmetic/HTML/fraction_arithmetic.html",
    "examples_only" : false}
   },

    {"question_file" : "../training/1-3_plus_4-9.brd"},
    {"question_file" : "../training/1-4_plus_2-5.brd"},
    {"question_file" : "../training/1-4_plus_2-6.brd"},
    {"question_file" : "../training/1-4_plus_2-7.brd"},
    {"question_file" : "../training/1-5_plus_4-6.brd"},
    {"question_file" : "../training/1-6_plus_2-6.brd"}

  ]
 }
]
}

Finally, the problem level parameters specify the HTML files for the tutor interfaces and the brd/nools files for particular problems. Agents will be trained in the order that they are given in the problem_set. Injecting "set_params" at this level will apply to all subsequent problems. If an outer_loop_controller is specified at the agent level, then the problem_set designates the set of problems that the controller can choose from. Always use the --outer-loop flag with train.py when using an outer loop controller.

{
 "training_set1" : [
 {

  "agent_name":"Control",
  "agent_type":"ModularAgent",
  "problem_set" : [

   {"README" : "If you want to explictly name the HTML each time that's fine too.",
    
   "HTML": "FractionArithmetic/HTML/fraction_arithmetic.html",
    "question_file" : "../training/1-3_plus_4-9.brd"},

    {"HTML": "FractionArithmetic/HTML/fraction_arithmetic.html",
    "question_file" : "../training/1-4_plus_2-5.brd"},

    {"HTML": "FractionArithmetic/HTML/fraction_arithmetic.html",
    "question_file" : "../training/1-4_plus_2-6.brd"},

    {"HTML": "FractionArithmetic/HTML/fraction_arithmetic.html",
    "question_file" : "../training/1-4_plus_2-7.brd"},

    {"HTML": "FractionArithmetic/HTML/fraction_arithmetic.html",
    "question_file" : "../training/1-5_plus_4-6.brd"},

    {"HTML": "FractionArithmetic/HTML/fraction_arithmetic.html",
    "question_file" : "../training/1-6_plus_2-6.brd"}

  ]
 }

]
}

A full training.json file might look like this. JSON is very picky about formatting. Remember to close all brackets, curly-brackets, and parentheses. Additionally, remember to separate elements with commas with no commas after the last element.

Agent Level Parameters

  • agent_name : A string specifying the name of the agent (used for logging)
  • agent_type : The type of agent (default "ModularAgent")
  • stay_active : true/false, if true keeps the agent in memory instead of serializing/deserializing between each HTTPS request
  • dont_save : true/false, if true the agent will not save after each call to train()
  • no_ops_parse: true/false, if true the agent will not try to retrieve operators from the django database. If true then feature_set/function_set must be set.
  • args : A JSON object specifying the arguments that will be passed to the agent. This might include the identifiers for particular implementations of where/when/which learners and the planner. For example:
{
 "when_learner": "trestle",
 "where_learner": "MostSpecific",
 "planner": "fo_planner"
}
  • feature_set : A list of identifiers for feature set operators that will be used to add predicates the problem state.
  • function_set : A list of identifiers for function set operators that can be chained together by the planner to explain examples.
  • repetitions : A positive integer designating the number of agents with the exact specifications set at this level which should be repeated. Repeated agents will have (#) appended to their name to distinguish between them in logging.
  • outer_loop_controller : The identifier for the outer loop controller. Requires the --outer-loop flag to be set. (see AL_outerloop)
  • problem_set : A list of problem objects

Problem Level Parameters

  • HTML : The path (relative to the training.json file) to the .html file containing the interface for the problem.
  • question_file: The path (relative to the .html file) to the brd/nools file containing a particular problem.
  • examples_only: true/false, if true the agent will simply be trained with examples of correct behavior without being allowed to propose next steps.
  • test_mode: true/false, if true the agent will not receive any feedback on this problem.
Clone this wiki locally