rlberry API¶
Manager¶
Main classes¶
|
Class to train, optimize hyperparameters, evaluate and gather statistics about an agent. |
|
Class to fit multiple ExperimentManager instances in parallel with multiple threads. |
Evaluation and plot¶
|
Compare sequentially agents, with possible early stopping. |
|
Evaluate and compare each of the agents in experiment_manager_list. |
|
Given a list of ExperimentManager or a folder, read data (corresponding to info) obtained in each episode. |
|
Given a list of ExperimentManager or a folder, plot data (corresponding to info) obtained in each episode. |
|
Plot the performances contained in the data (see data parameter to learn what format it should be). |
|
Plot the performances contained in the data (see data parameter to learn what format it should be). |
|
Compare several trained agents using the mean over n_simulations evaluations for each agent. |
Function to convert 'tensorboard log' to 'Panda DataFrames'. |
Agents¶
Base classes¶
|
Basic interface for agents. |
|
Interface for agents whose policy is a function of observations only. |
Agent importation tools¶
Wraps an StableBaselines3 Algorithm with a rlberry Agent. |
Environments¶
Base class¶
Base class for an environment model. |
|
|
Wraps a given environment, similar to OpenAI gym's wrapper [1,2] (now updated to gymnasium). |
Spaces¶
Class that represents discrete spaces. |
|
|
Class that represents a space that is a cartesian product in R^n: |
|
Inherited from gymnasium.spaces.Tuple for compatibility with gym. |
|
Inherited from gymnasium.spaces.MultiDiscrete for compatibility with gym. |
Inherited from gymnasium.spaces.MultiBinary for compatibility with gym. |
|
|
Inherited from gymnasium.spaces.Dict for compatibility with gym. |
Environment tools¶
|
Same as gym.make, but wraps the environment to ensure unified seeding with rlberry. |
|
Adaptor to manage Atari Env |
|
Environment defined as a pipeline of wrappers and an environment to wrap. |
Seeding¶
|
Base class to define objects that use random number generators. |
|
Calls obj.reseed(seed_seq) method if available; If a obj.seed() method is available, call obj.seed(seed_val), where seed_val is generated by the seeder. |
|
Set seeds of external libraries. |
Utilities, Logging & Typing¶
Manager Utilitis¶
|
Preset an ExperimentManager to some fixed keywords. |
Virtual environment Utilities¶
|
Decorator to run the script in a function using a virtual environment. |
|
Function to launch experiments in the current script file in virtual environments. |
Writer Utilities¶
|
Default writer to be used by the agents, optionally wraps an instance of tensorboard.SummaryWriter. |
|
Replay buffer that allows sampling data with shape (batch_size, time_size, ...). |
Check Utilities¶
utils.check_rl_agent
(agent[, env, init_kwargs])Check ExperimentManager compatibility and check reproducibility/seeding.
utils.check_env
(env)Check that the environment is (almost) gym-compatible and that it is reproducible in the sense that it returns the same states when given the same seed.
utils.check_save_load
(agent[, env, init_kwargs])
utils.check_fit_additive
(agent[, env, ...])Check that fitting two times with 10 fit budget is the same as fitting one time with 20 fit budget.
utils.check_seeding_agent
(agent[, env, ...])Check that the agent is reproducible.
utils.check_experiment_manager
(agent[, env, ...])Check that the agent is compatible with
ExperimentManager
.
Logging Utilities¶
|
Set rlberry's logger level. |
Environment Wrappers¶
Discretize an environment with continuous states and discrete actions. |
|
Allow to use old gym env (V0.21) with rlberry (gymnasium). |
|
|
Rescale the reward function to a bounded range. |