Base_agent

class conformer_rl.agents.base_agent.BaseAgent(config: conformer_rl.config.agent_config.Config)

Base interface for building reinforcement learning agents.

Parameters

config (Config) – Configuration object for the agent. See notes for a list of config parameters used by specific pre-built agents.

config

Configuration object used for the agent.

Type

Config

unique_tag

Unique identifier string for the current training session. Used to identify this session in logging.

Type

str

eval_logger

Used for logging environment data when evaluating agent.

Type

EnvLogger

train_logger

Used for logging agent data while training.

Type

TrainLogger

total_steps

Total number of environment interactions/steps taken by the agent.

Type

int

storage

Used to save environment samples, analogous to a replay buffer.

Type

Storage

run_steps() None

Trains the agent.

Trains the agent until the maximum number of steps (specified by config) is reached. Also periodically saves neural network parameters and performs evaluations on the agent, if specified in the config.

step() None

Performs one iteration of acquiring samples on the environment and then trains on the acquired samples.

_eval_episode() dict

Evalutes the agent on a single episode of the evaluation environment.

Returns

Information from the evaluation environment to be logged by the eval_logger.

Return type

dict

evaluate() None

Evaluates the agent on the evaluation environment.

Information dict returned by the environment’s conformer_rl.environments.conformer_env.ConformerEnv.step() method is logged by the eval_logger and saved.

load(filename: str) None

Loads the neural network with weights.

Parameters

filename (str) – The path where the neural network weights are saved.

save(filename: str) None

Saves the neural network weights to a file.

Parameters

filename (str) – The path where the neural network weights are to be saved.