benchmarl
benchmarl.run
benchmarl.hydra_config
- load_experiment_from_hydra(cfg: DictConfig, task_name: str, callbacks=()) Experiment [source]
Creates an
Experiment
from hydra config.- Parameters:
cfg (DictConfig) – the config dictionary from hydra main
task_name (str) – the name of the task to load
- Returns:
- load_task_config_from_hydra(cfg: DictConfig, task_name: str) Task [source]
Returns a
Task
from hydra config.
- load_experiment_config_from_hydra(cfg: DictConfig) ExperimentConfig [source]
Returns a
ExperimentConfig
from hydra config.- Parameters:
cfg (DictConfig) – the experiment config dictionary from hydra
- Returns:
- load_algorithm_config_from_hydra(cfg: DictConfig) AlgorithmConfig [source]
Returns a
AlgorithmConfig
from hydra config.- Parameters:
cfg (DictConfig) – the algorithm config dictionary from hydra
- Returns:
- load_model_config_from_hydra(cfg: DictConfig) ModelConfig [source]
Returns a
ModelConfig
from hydra config.- Parameters:
cfg (DictConfig) – the model config dictionary from hydra
- Returns:
- reload_experiment_from_file(restore_file: str) Experiment [source]
Reloads the experiment from a given restore file.
Requires a
.hydra
folder containingconfig.yaml
,hydra.yaml
, andoverrides.yaml
at max three directory levels higher than the checkpoint file. This should be automatically created by hydra.- Parameters:
restore_file (str) – The checkpoint file of the experiment reload.
benchmarl.eval_results
- get_raw_dict_from_multirun_folder(multirun_folder: str) Dict [source]
Get the
marl-eval
input dictionary from the folder of a hydra multirun.Examples
from benchmarl.eval_results import get_raw_dict_from_multirun_folder, Plotting raw_dict = get_raw_dict_from_multirun_folder( multirun_folder="some_prefix/multirun/2023-09-22/17-21-34" ) processed_data = Plotting.process_data(raw_dict)
- Parameters:
multirun_folder (str) – the absolute path to the multirun folder
- Returns:
the dict obtained by merging all the json files in the multirun
- load_and_merge_json_dicts(json_input_files: List[str], json_output_file: str | None = None) Dict [source]
Loads and merges json dictionaries to form the
marl-eval
input dictionary .
- class Plotting[source]
Class containing static utilities for plotting in
marl-eval
.Examples
>>> from benchmarl.eval_results import get_raw_dict_from_multirun_folder, Plotting >>> raw_dict = get_raw_dict_from_multirun_folder( ... multirun_folder="some_prefix/multirun/2023-09-22/17-21-34" ... ) >>> processed_data = Plotting.process_data(raw_dict) ... ( ... environment_comparison_matrix, ... sample_efficiency_matrix, ... ) = Plotting.create_matrices(processed_data, env_name="vmas") >>> Plotting.performance_profile_figure( ... environment_comparison_matrix=environment_comparison_matrix ... ) >>> Plotting.aggregate_scores( ... environment_comparison_matrix=environment_comparison_matrix ... ) >>> Plotting.environemnt_sample_efficiency_curves( ... sample_effeciency_matrix=sample_efficiency_matrix ... ) >>> Plotting.task_sample_efficiency_curves( ... processed_data=processed_data, env="vmas", task="navigation" ... ) >>> plt.show()
- METRICS_TO_NORMALIZE = ['return']
- METRIC_TO_PLOT = 'return'
- static process_data(raw_data: Dict) Dict [source]
Call
data_process_pipeline
to normalize the chosen metrics and to clean the data- Parameters:
raw_data (dict) – the input data
- Returns:
the processed dict