hive.runners.single_agent_loop module

class hive.runners.single_agent_loop.SingleAgentRunner(environment, agent, logger, experiment_manager, train_steps, test_frequency, test_episodes, stack_size, max_steps_per_episode=27000)[source]

Bases: hive.runners.base.Runner

Runner class used to implement a sinle-agent training loop.

Initializes the Runner object.

Parameters
  • environment (BaseEnv) – Environment used in the training loop.

  • agent (Agent) – Agent that will interact with the environment

  • logger (ScheduledLogger) – Logger object used to log metrics.

  • experiment_manager (Experiment) – Experiment object that saves the state of the training.

  • train_steps (int) – How many steps to train for. If this is -1, there is no limit for the number of training steps.

  • test_frequency (int) – After how many training steps to run testing episodes. If this is -1, testing is not run.

  • test_episodes (int) – How many episodes to run testing for duing each test phase.

  • stack_size (int) – The number of frames in an observation sent to an agent.

  • max_steps_per_episode (int) – The maximum number of steps to run an episode for.

run_one_step(observation, episode_metrics)[source]

Run one step of the training loop.

Parameters
  • observation – Current observation that the agent should create an action for.

  • episode_metrics (Metrics) – Keeps track of metrics for current episode.

run_episode()[source]

Run a single episode of the environment.

hive.runners.single_agent_loop.set_up_experiment(config)[source]

Returns a SingleAgentRunner object based on the config and any command line arguments.

Parameters

config – Configuration for experiment.

hive.runners.single_agent_loop.main()[source]