yawning_titan.experiment_helpers.sb3#
Functions
Use the Stable Baselines 3 Monitor wrappper to wrap an environment in order to enable monitoring. |
|
Take a metric name and a list of values and prints associated stats. |
|
Output policy evaluation metrics and summary statistics. |
|
Train and Evaluate an agent. |
- yawning_titan.experiment_helpers.sb3.init_env(env, experiment_id)[source]#
Use the Stable Baselines 3 Monitor wrappper to wrap an environment in order to enable monitoring.
- Parameters:
env – the registered name of an OpenAI gym environment (str)
experiment_id – a UID for the experiment (str)
- Returns:
A Stable Baselines 3 Monitor Wrapped Gym Environment
- yawning_titan.experiment_helpers.sb3.train_and_eval(agent_name, environment, training_timesteps, n_eval_episodes)[source]#
Train and Evaluate an agent.
- Parameters:
agent_name – the algorithm name (str)
environment – An initlaised Open AI Gym environment
training_timesteps – total no. of training timesteps (int)
- Returns:
a trained Stable Baselines 3 agent eval_pol: the output from the Stable Baselines 3 ‘evaluate_policy’ function
- Return type:
chosen_agent
- yawning_titan.experiment_helpers.sb3.print_metric_stats(metric_name, metrics, raw_metrics=False)[source]#
Take a metric name and a list of values and prints associated stats.
- Parameters:
metric_name – The metric name (str)
metrics – A list of ints/float metric readings(list)
- yawning_titan.experiment_helpers.sb3.print_policy_eval_metrics(agents, evals, raw_metrics=False)[source]#
Output policy evaluation metrics and summary statistics.
- Parameters:
agents – An index of the agents that were evaluated(list)
evals – The output from Stable Baselines 3 ‘evaluate_policy’ for each of the agents trained