cave.reader.conversion.hpbandster2smac module

class cave.reader.conversion.hpbandster2smac.HpBandSter2SMAC[source]

Bases: cave.reader.conversion.base_converter.BaseConverter

Converts data from hpbandster at least up to the 1.0 release into SMAC3 data.

_get_config(config_id, id2config, cs)[source]
convert(folders, ta_exec_dirs=None, output_dir=None, converted_dest='converted_input_data')[source]

Convert specific format results into SMAC3-format.

Parameters
  • folders (List[str]) – list of parallel configurator-runs (folder paths!)

  • ta_exec_dirs (List[str]) – only if you need to load instances, this is the path(s) from which the paths in the scenario are valid

  • output_dir (str) – path to CAVE’s output-directory

  • converted_dest (str) – optional, this will be the parent folder in CAVE’s output in which the converted runs (in SMAC-format) are saved, if not specified, will use temporary folders

Returns

result

dict{
  original_folder : dict{
    'new_path' : converted_folder_path,
    'config_space' : config_space,
    'runhistory' : runhistory,
    'validated_runhistory' : validated_runhistory,
    'scenario' : scenario,
    'trajectory' : trajectory,
  }
}

in addition, the result-dictionary can contain any number of arbitrary key-value pairs, that will be available in CAVE’s RunsContainer

Return type

dictionary

get_trajectory(result, output_path, scenario, rh)[source]

Use hpbandster’s averaging.

hpbandster2smac(folder, result, cs_options, output_dir: str)[source]

Reading hpbandster-result-object and creating RunHistory and trajectory…

Parameters
  • folder (str (path)) – original folder

  • result (hpbandster.core.result.Result) – bohb’s result-object

  • cs_options (list[ConfigurationSpace]) – the configuration spaces. in the best case it’s a single element, but for pcs-format we need to guess through a list of possible configspaces

  • output_dir_base (str) – the output-dir to save the smac-runs to

Returns

converted – ‘new_path’ : path_to_converted_input, ‘hp_bandster_result’ : result_in_hpbandster_format, ‘config_space’ : config_space, ‘runhistory’ : runhistory, ‘validated_runhistory’ : validated_runhistory, ‘scenario’ : scenario, ‘trajectory’ : trajectory, }

Return type

dict{

load_configspace(folder)[source]

Will try to load the configspace. cs_options will be a list containing all possible combinations of interpretation for Categoricals. If this issue will be fixed, we can drop this procedure.

Parameters

folder (str) – path to folder in which to look for configspace

Returns

cs_options – list with possible interpretations for config-space-file. Only contains multiple items if file-format is pcs.

Return type

list[ConfigurationSpace]