Env_logger
- class conformer_rl.logging.env_logger.EnvLogger(tag: str, dir: str = 'data')
Used by the agent for logging metrics produced by the environment, for example, observations, rewards, renders, etc. Supports saving data to pickle and saving molecules as .mol files.
- Parameters
tag (str) – Unique tag for identifying the logging session.
dir (str) – Path to root directory for where logging results should be saved.
- step_data
Used for storing data for every step of a single episode. Maps from strings to lists, where each index of the list corresponds to the data for that corresponding step within the episode.
- Type
dict
- episode_data
Used for storing information for a single episode. Used to store the self.step_data for that episode and metadata global to the entire episode.
- Type
dict
- cache
Used for storing data across several episodes. Maps from strings to lists, where each index of the list corresponds to an episode.
- Type
dict
- clear_data() None
Resets the logger.
- clear_episode() None
Clears episode and step data.
- log_step_item(key: str, val: Any) None
Logs a single key value pair for current step.
If an existing key is found, the value is appended to the list associated with that key.
- Parameters
key (str) – the key for the data to be added.
val (Any) – the value of the data to be added.
- log_step(step_data: dict) None
Logs each key-value pair for current step.
If an existing key is found, the value is appended to the list associated with that key.
- Parameters
step_data (dict) – Contains key-value pairs to be logged.
- log_episode_item(key: str, value: Any) None
Logs a single key-value pair to the per-episode data.
- log_episode(episode_data: dict) None
Logs each key-value pair to the per-episode data.
Also adds step_data to the per-episode data with corresponding key ‘step_data’. Existing keys will be overwritten.
- Parameters
episode_data (dict) – Contains key-value pairs to be logged.
- save_episode(subdir: str, save_pickle: bool = True, save_molecules: bool = False, save_cache: bool = False) None
Saves current episode_data with options for dumping to pickle file, saving data to a cache dict, and saving the rdkit molecules as .mol files. Clears the current episode and step data.
- Parameters
subdir (str) – The directory for episode data to be saved (relative to self.dir)
save_pickle (bool) – If True, dumps episode_data as a .pickle file.
save_molecules (bool) – If True, and ‘molecule’ key exists in step_data, dumps each molecule generated throughout the episode as a .mol file uniquely named by the step number.
save_cache (bool) – If True, episode data is cached to self.data.
- _add_to_cache(data: dict) None
Logs each key-value pair in data to self.cache. If an existing key is found, the value is appended to the list associated with that key.
- Parameters
data (dict) – contains key-value pairs to be logged.