Configuration

class ConfigSpace.configuration_space.Configuration(configuration_space, values=None, vector=None, allow_inactive_with_values=False, origin=None, config_id=None)[source]

Class for a single configuration.

The Configuration object holds for all active hyperparameters a value. While the ConfigurationSpace stores the definitions for the hyperparameters (value ranges, constraints,…), a Configuration object is more an instance of it. Parameters of a Configuration object can be accessed and modified similar to python dictionaries (c.f. Guide).

Parameters:
  • configuration_space (ConfigurationSpace) –

  • values (dict, optional) – A dictionary with pairs (hyperparameter_name, value), where value is a legal value of the hyperparameter in the above configuration_space

  • vector (np.ndarray, optional) – A numpy array for efficient representation. Either values or vector has to be given

  • allow_inactive_with_values (bool, optional) – Whether an Exception will be raised if a value for an inactive hyperparameter is given. Default is to raise an Exception. Default to False

  • origin (Any, optional) – Store information about the origin of this configuration. Defaults to None

  • config_id (int, optional) – Integer configuration ID which can be used by a program using the ConfigSpace package.

get(k[, d]) D[k] if k in D, else d.  d defaults to None.
get_array()[source]

The internal vector representation of this config.

All continuous values are scaled between zero and one.

Returns:

The vector representation of the configuration

Return type:

numpy.ndarray

get_dictionary()[source]

A representation of the Configuration in dictionary form.

Returns:

Configuration as dictionary

Return type:

dict

is_valid_configuration()[source]

Check if the object is a valid.

Raises:

ValueError – If configuration is not valid.:

Return type:

None

items() a set-like object providing a view on D's items
keys()[source]

Return the keys of the configuration.

Returns:

The keys of the configuration

Return type:

KeysView[str]

values() an object providing a view on D's values