Experiment
- exec_run(agent_builder, env_builder, n_epochs, n_steps=None, n_episodes=None, n_steps_test=None, n_episodes_test=None, seed=None, save_agent=False, quiet=True, **kwargs)[source]
Function that handles the execution of an experiment run.
- Parameters:
agent_builder (AgentBuilder) – agent builder to spawn an agent;
env_builder (EnvironmentBuilder) – environment builder to spawn an environment;
n_epochs (int) – number of epochs;
n_steps (int, None) – number of steps per epoch;
n_episodes (int, None) – number of episodes per epoch;
n_steps_test (int, None) – number of steps for testing;
n_episodes_test (int, None) – number of episodes for testing;
seed (int, None) – the seed;
save_agent (bool, False) – select if the agent should be logged or not;
quiet (bool, True) – select if run should print execution information.
- compute_metrics(core, eval_params, agent_builder, env_builder)[source]
Function to compute the metrics.
- Parameters:
eval_params (dict) – parameters for running the evaluation;
agent_builder (AgentBuilder) – the agent builder;
env_builder (EnvironmentBuilder) – environment builder to spawn an environment;
- print_metrics(logger, epoch, J, R, V, E)[source]
Function that pretty prints the metrics on the standard output.
- Parameters:
logger (Logger) – MushroomRL logger object;
epoch (int) – the current epoch;
J (float) – the current value of J;
R (float) – the current value of R;
V (float) – the current value of V;
E (float) – the current value of E (Set None if not defined).
Slurm utilities
- aggregate_results(res_dir, res_id, console_log_dir=None)[source]
Function to aggregate the benchmark results from running in SLURM mode.
- Parameters:
res_dir (str) – path to the result directory;
res_id (str) – log id of the result directory;
console_log_dir (str,None) – path to be used to log console.
- read_arguments_run(arg_string=None)[source]
Parse the arguments for the run script.
- Parameters:
arg_string (str, None) – pass the argument string.
- read_arguments_aggregate(arg_string=None)[source]
Parse the arguments for the aggregate script.
- Parameters:
arg_string (str, None) – pass the argument string.
- create_slurm_script(slurm_path, slurm_script_name='slurm.sh', **slurm_params)[source]
Function to create a slurm script in a specific directory
- Parameters:
slurm_path (str) – path to locate the slurm script;
slurm_script_name (str, slurm.sh) – name of the slurm script;
**slurm_params – parameters for generating the slurm file content.
- Returns:
The path to the slurm script.
- generate_slurm(exp_name, exp_dir_slurm, python_file, gres=None, project_name=None, partition=None, n_exp=1, max_concurrent_runs=None, memory=2000, hours=24, minutes=0, seconds=0)[source]
Function to generate the slurm file content.
- Parameters:
exp_name (str) – name of the experiment;
exp_dir_slurm (str) – directory where the slurm log files are located;
python_file (str) – path to the python file that should be executed;
gres (str, None) – request cluster resources. E.g. to add a GPU in the IAS cluster specify gres=’gpu:rtx2080:1’;
project_name (str, None) – name of the slurm project;
partition (str, None) – name of the partition to be used.
n_exp (int, 1) – number of experiments in the slurm array;
max_concurrent_runs (int, None) – maximum number of runs that should be executed in parallel on the SLURM cluster;
memory (int, 2000) – memory limit in mega bytes (MB) for the slurm jobs;
hours (int, 24) – maximum number of execution hours for the slurm jobs;
minutes (int, 0) – maximum number of execution minutes for the slurm jobs;
seconds (int, 0) – maximum number of execution seconds for the slurm jobs.
- Returns:
The slurm script as string.