From 3a6ae9de41ea9aded4736d5299ed18725dbd5be0 Mon Sep 17 00:00:00 2001 From: Matteo Bettini Date: Sat, 25 Nov 2023 13:22:36 +0000 Subject: [PATCH] Docs --- benchmarl/benchmark/benchmark.py | 17 +++++++++++++++++ docs/source/modules/benchmark.rst | 9 +++------ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/benchmarl/benchmark/benchmark.py b/benchmarl/benchmark/benchmark.py index a2a296a0..6d59eaff 100644 --- a/benchmarl/benchmark/benchmark.py +++ b/benchmarl/benchmark/benchmark.py @@ -13,6 +13,20 @@ class Benchmark: + """A benchmark. + + Benchmarks are collections of experiments to compare. + + Args: + algorithm_configs (list of AlgorithmConfig): the algorithms to benchmark + model_config (ModelConfig): the config of the policy model + tasks (list of Task): the tasks to benchmark + seeds (set of int): the seeds for the benchmark + experiment_config (ExperimentConfig): the experiment config + critic_model_config (ModelConfig, optional): the config of the critic model. Defaults to model_config + + """ + def __init__( self, algorithm_configs: Sequence[AlgorithmConfig], @@ -36,9 +50,11 @@ def __init__( @property def n_experiments(self): + """The number of experiments in the benchmark.""" return len(self.algorithm_configs) * len(self.tasks) * len(self.seeds) def get_experiments(self) -> Iterator[Experiment]: + """Yields one experiment at a time""" for algorithm_config in self.algorithm_configs: for task in self.tasks: for seed in self.seeds: @@ -52,6 +68,7 @@ def get_experiments(self) -> Iterator[Experiment]: ) def run_sequential(self): + """Run all the experiments in the benchmark in a sequence.""" for i, experiment in enumerate(self.get_experiments()): print(f"\nRunning experiment {i+1}/{self.n_experiments}.\n") try: diff --git a/docs/source/modules/benchmark.rst b/docs/source/modules/benchmark.rst index 8119d840..3d5e9e99 100644 --- a/docs/source/modules/benchmark.rst +++ b/docs/source/modules/benchmark.rst @@ -12,9 +12,6 @@ benchmarl.benchmark Benchmark --------- -.. autosummary:: - :nosignatures: - :toctree: ../generated - :template: autosummary/class.rst - - Benchmark +.. automodule:: benchmarl.benchmark.benchmark + :members: + :undoc-members: