cave.reader.conversion.csv2smac module

class cave.reader.conversion.csv2smac.CSV2SMAC[source]

Bases: cave.reader.conversion.base_converter.BaseConverter

Converting CSV-data to SMAC3-format.

classmethod check_for_files(path)[source]

Returns True if all files needed for CSV formatted results are detected in target folder

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_runhistory(folder, scenario, filename='runhistory.csv')[source]

Reads runhistory in csv-format:

config_id

instance_id

cost

time

seed

status

(budget)

name of config 1

name of instance 1

where config_id and instance_id can also be replaced by columns for the individual parameters/instance features

Sets self.id_to_config (dict)

Returns

rh – runhistory

Return type

RunHistory

get_scenario(path, ta_exec_dir=None, out_path=None)[source]
get_trajectory(folder, cs, scenario, output_path)[source]

Reads folder/trajectory.csv, expected format:

cpu_time

cost

wallclock_time

evaluations

config_id

or

cpu_time

cost

wallclock_time

evaluations

parameter1

parameter2

Writes trajectory to trajectory-file in output-dir

Returns

traj – Returns trajectory as list

Return type

List[TrajEntry]