Configuration Repository#
ConfigItem(config_id, config, results)
dataclass
#
Data class to store information regarding a specific configuration.
The results for this configuration are stored in the results
dict, using the fidelity it has
been evaluated on as keys.
ResultItem(score, cost, info)
dataclass
#
Data class storing the result information of a specific configuration + fidelity.
ConfigRepository()
#
Bookkeeps all configurations used throughout the course of the optimization.
Keeps track of the configurations and their results on the different fidelitites.
A new configuration is announced via announce_config
. After evaluating the configuration
on the specified fidelity, use tell_result
to log the achieved performance, cost etc.
The configurations are stored in a list of ConfigItem
.
Initializes the class by calling self.reset
.
Source code in src/dehb/utils/config_repository.py
reset()
#
announce_config(config, fidelity=None)
#
Announces a new configuration with the respective fidelity it should be evaluated on.
The configuration is then added to the list of so far seen configurations and the ID of the configuration is returned.
PARAMETER | DESCRIPTION |
---|---|
config |
New configuration
TYPE:
|
fidelity |
Fidelity on which
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
int
|
ID of configuration |
Source code in src/dehb/utils/config_repository.py
announce_population(population, fidelity=None)
#
Announce population, retrieving ids for the population.
PARAMETER | DESCRIPTION |
---|---|
population |
Population to announce
TYPE:
|
fidelity |
Fidelity on which pop is evaluated or None. Defaults to None.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
ndarray
|
population ids |
Source code in src/dehb/utils/config_repository.py
announce_fidelity(config_id, fidelity)
#
Announce the evaluation of a new fidelity for a given config.
This function may only be used if the config already exists in the repository. Note: This function is currently unused, but might be used later in order to allow for continuation.
PARAMETER | DESCRIPTION |
---|---|
config_id |
ID of Configuration
TYPE:
|
fidelity |
Fidelity on which the config will be evaluated
TYPE:
|
Source code in src/dehb/utils/config_repository.py
tell_result(config_id, fidelity, score, cost, info)
#
Logs the achieved performance, cost etc. of a specific configuration-fidelity pair.
PARAMETER | DESCRIPTION |
---|---|
config_id |
ID of evaluated configuration
TYPE:
|
fidelity |
Fidelity on which configuration has been evaluated.
TYPE:
|
score |
Achieved score, given by objective function
TYPE:
|
cost |
Cost, given by objective function
TYPE:
|
info |
Run info, given by objective function
TYPE:
|
Source code in src/dehb/utils/config_repository.py
get(config_id)
#
Get the configuration with the given ID.
PARAMETER | DESCRIPTION |
---|---|
config_id |
ID of config
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
ndarray
|
Config in hypercube representation |
Source code in src/dehb/utils/config_repository.py
serialize_configs(configs)
#
Returns the configurations in logging format.
PARAMETER | DESCRIPTION |
---|---|
configs |
Configs to parse into logging format
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
list
|
Configs in logging format |
Source code in src/dehb/utils/config_repository.py
save_state(save_path)
#
Saves the current state to save_path
.
PARAMETER | DESCRIPTION |
---|---|
save_path |
Path where the state should be saved to.
TYPE:
|
Source code in src/dehb/utils/config_repository.py
get_serialized_initial_configs()
#
Returns the initial configs in a format, that can be JSON serialized.