smac.utils.io.input_reader

Classes

InputReader()

Reading all input files for SMAC (scenario file, instance files, ...)

class smac.utils.io.input_reader.InputReader[source]

Bases: object

Reading all input files for SMAC (scenario file, instance files, …)

Note: Most of this code was taken from the pysmac repository.

We copy it here because we don’t want smac3 to depend on an earlier version!

read_instance_features_file(fn)[source]

Encapsulates read_instances_file of pysmac

Parameters

fn (string) – File name of instance feature file

Returns

features – first entry is a list of the feature names, second one is a dict with ‘instance name’ - ‘numpy array containing the features’ key-value pairs

Return type

tuple

read_instance_file(fn)[source]

Encapsulates read_instances_file of pysmac

Parameters

fn (string) – File name of instance file

Returns

instances – Each element is a list where the first element is the instance name followed by additional information for the specific instance.

Return type

list

static read_pcs_file(fn, logger=None)[source]

Encapsulates generating configuration space object from file.

Automatically detects whether the cs is saved in json, pcs or pcs_new.

Parameters

fn (string) – File name of pcs file

Returns

ConfigSpace

Return type

ConfigSpace

read_scenario_file(fn)[source]

Encapsulates read_scenario_file of pysmac

Parameters

fn (string) – File name of scenario file

Returns

dict – (key, value) pairs are (variable name, variable value)

Return type

dictionary