trainer

Module trainer. Specifies a utility class for training serial reinforcement learning algorithms

class trainer.TrainerConfig(n_episodes: int = 1, output_msg_frequency: int = - 1)
class trainer.Trainer(env: Env, agent: Agent, configuration: TrainerConfig)
__init__(env: Env, agent: Agent, configuration: TrainerConfig) None

Constructor. Initialize a trainer by passing the training environment instance the agen to train and configuration dictionary

Parameters
  • env (The environment to train the agent) –

  • agent (The agent to train) –

  • configuration (Configuration parameters for the trainer) –

actions_after_episode_ends(env: Env, episode_idx: int, **options) None

Any actions after the training episode ends

Parameters
  • env (The environment to train on) –

  • episode_idx (The training episode index) –

  • options (Any options passed by the client code) –

Return type

None

actions_before_episode_begins(env: Env, episode_idx: int, **options) None

Perform any actions necessary before the training begins

Parameters
  • env (The environment to train on) –

  • episode_idx (The training episode index) –

  • options (Any options passed by the client code) –

Return type

None

actions_before_training() None

Any actions to perform before training begins

Return type

None

avg_distortion() array

Returns the average reward per episode :return:

avg_rewards() array

Returns the average reward per episode :return:

train() None

Train the agent on the given environment

Return type

None