deephyper.core.analytics.DBManager#
- class deephyper.core.analytics.DBManager(username: str = None, path: str = None)[source]#
Bases:
ABC
Database Manager, for saving DeepHyper experiments and accessing/modifying the resulting databases.
Example Usage:
>>> dbm = DBManager(username="Bob", path="path/to/db.json")
- Parameters:
Methods
Adds an experiment to the database.
Deletes an experiment from the database.
Retrieve the desired experiment from the database.
Returns an iterator over the records stored in the database.
- add(log_dir: str, label: str = None, description: str = None, pip_versions: str | bool = True, metadata: dict = None) int [source]#
Adds an experiment to the database.
Example Usage:
>>> dbm = DBManager(username="Bob", path="path/to/db.json") >>> metadata = {"machine": "ThetaGPU", "n_nodes": 4, "num_gpus_per_node": 8} >>> dbm.add("path/to/search/log_dir/", label="exp_101", description="The experiment 101", metadata=metadata)
- Parameters:
log_dir (str) – the path to the search’s logging directory.
label (str, optional) – the label wished for the experiment. Defaults to None.
description (str, optional) – the description wished for the experiment. Defaults to None.
pip_versions (str or bool, optional) – a boolean for which
False
means that we don’t store any pip version checkpoint, andTrue
that we store the current pip version checkpoint ; or the path to a.json
file corresponding to the ouptut ofpip list --format json
. Defaults to True.metadata (dict, optional) – a dictionary of metadata. When the same key is found in the default default_metadata and the passed metadata then the values from default_metadata are overriden by metadata values. Defaults to None.
- delete(ids: list)[source]#
Deletes an experiment from the database.
Example Usage:
>>> dbm = DBManager(username="Bob", path="path/to/db.json") >>> dbm.delete([23, 16])
- Parameters:
ids (list) – indexes of the records to delete.