colosseum.experiment.config
1from dataclasses import dataclass 2from typing import Type 3 4import yaml 5 6from colosseum.emission_maps import EmissionMap 7from colosseum.utils import ensure_folder 8 9 10@dataclass(frozen=True) 11class ExperimentConfig: 12 n_seeds: int 13 """is the number of seed each agent/MDP interaction is repeated.""" 14 n_steps: int 15 """is the optimization horizon.""" 16 max_interaction_time_s: float 17 """is the maximum training time given to the agent in seconds.""" 18 log_performance_indicators_every: int 19 """is the number of step after which the performance indicators are calculated and stored.""" 20 emission_map: Type["EmissionMap"] = None 21 """is the emission map for the MDP.""" 22 23 def store_at(self, dest_folder: str): 24 with open(ensure_folder(dest_folder) + "experiment_config.yml", "w") as f: 25 conf = { 26 "n_seeds": self.n_seeds, 27 "n_steps": self.n_steps, 28 "max_interaction_time_s": self.max_interaction_time_s, 29 "log_performance_indicators_every": self.log_performance_indicators_every, 30 } 31 if self.emission_map is not None: 32 conf["emission_map"] = self.emission_map.__name__ 33 34 yaml.dump(conf, f)
@dataclass(frozen=True)
class
ExperimentConfig:
11@dataclass(frozen=True) 12class ExperimentConfig: 13 n_seeds: int 14 """is the number of seed each agent/MDP interaction is repeated.""" 15 n_steps: int 16 """is the optimization horizon.""" 17 max_interaction_time_s: float 18 """is the maximum training time given to the agent in seconds.""" 19 log_performance_indicators_every: int 20 """is the number of step after which the performance indicators are calculated and stored.""" 21 emission_map: Type["EmissionMap"] = None 22 """is the emission map for the MDP.""" 23 24 def store_at(self, dest_folder: str): 25 with open(ensure_folder(dest_folder) + "experiment_config.yml", "w") as f: 26 conf = { 27 "n_seeds": self.n_seeds, 28 "n_steps": self.n_steps, 29 "max_interaction_time_s": self.max_interaction_time_s, 30 "log_performance_indicators_every": self.log_performance_indicators_every, 31 } 32 if self.emission_map is not None: 33 conf["emission_map"] = self.emission_map.__name__ 34 35 yaml.dump(conf, f)
ExperimentConfig( n_seeds: int, n_steps: int, max_interaction_time_s: float, log_performance_indicators_every: int, emission_map: Type[colosseum.emission_maps.base.EmissionMap] = None)
log_performance_indicators_every: int
is the number of step after which the performance indicators are calculated and stored.
def
store_at(self, dest_folder: str):
24 def store_at(self, dest_folder: str): 25 with open(ensure_folder(dest_folder) + "experiment_config.yml", "w") as f: 26 conf = { 27 "n_seeds": self.n_seeds, 28 "n_steps": self.n_steps, 29 "max_interaction_time_s": self.max_interaction_time_s, 30 "log_performance_indicators_every": self.log_performance_indicators_every, 31 } 32 if self.emission_map is not None: 33 conf["emission_map"] = self.emission_map.__name__ 34 35 yaml.dump(conf, f)