run_experiment.Runner
Class Runner
Object that handles running Atari 2600 experiments.
Here we use the term ‘experiment’ to mean simulating interactions between the
agent and the environment and reporting some statistics pertaining to these
interactions.
A simple scenario to train a DQN agent is as follows:
base_dir = '/tmp/simple_example'
def create_agent(sess, environment):
return dqn_agent.DQNAgent(sess, num_actions=environment.action_space.n)
runner = Runner(base_dir, create_agent, game_name='Pong')
runner.run()
Methods
init
__init__(
*args,
**kwargs
)
Initialize the Runner object in charge of running a full experiment.
Args:
base_dir
: str, the base directory to host all required
sub-directories.create_agent_fn
: A function that takes as args a Tensorflow session
and an Atari 2600 Gym environment, and returns an agent.create_environment_fn
: A function which receives a game name and
creates an Atari 2600 Gym environment.game_name
: str, name of the Atari 2600 domain to run (required).sticky_actions
: bool, whether to enable sticky actions in the
environment.checkpoint_file_prefix
: str, the prefix to use for checkpoint
files.logging_file_prefix
: str, prefix to use for the log files.log_every_n
: int, the frequency for writing logs.num_iterations
: int, the iteration number threshold (must be
greater than start_iteration).training_steps
: int, the number of training steps to perform.evaluation_steps
: int, the number of evaluation steps to perform.max_steps_per_episode
: int, maximum number of steps after which an
episode terminates.
This constructor will take the following actions: - Initialize an environment. -
Initialize a tf.Session
. - Initialize a logger. - Initialize an agent. -
Reload from the latest checkpoint, if available, and initialize the Checkpointer
object.
run_experiment
run_experiment()
Runs a full experiment, spread over multiple iterations.