syne_tune.optimizer.schedulers.searchers.bayesopt.datatypes.config_ext module

class syne_tune.optimizer.schedulers.searchers.bayesopt.datatypes.config_ext.ExtendedConfiguration(hp_ranges, resource_attr_key, resource_attr_range)[source]

Bases: object

This class facilitates handling extended configs, which consist of a normal config and a resource attribute.

The config space hp_ranges is extended by an additional resource attribute. Note that this is not a hyperparameter we optimize over, but it is under the control of the scheduler. Its allowed range is [1, resource_attr_range[1]], which can be larger than [resource_attr_range[0], resource_attr_range[1]]. This is because extended configs with resource values outside of resource_attr_range may arise (for example, in the early stopping context, we may receive data from epoch < resource_attr_range[0]).

get(config, resource)[source]

Create extended config with resource added.

Parameters:
  • config (Dict[str, Union[int, float, str]]) – Non-extended config

  • resource (int) – Resource value

Return type:

Dict[str, Union[int, float, str]]

Returns:

Extended config

remove_resource(config_ext)[source]

Strips away resource attribute and returns normal config. If config_ext is already normal, it is returned as is.

Parameters:

config_ext (Dict[str, Union[int, float, str]]) – Extended config

Return type:

Dict[str, Union[int, float, str]]

Returns:

config_ext without resource attribute

split(config_ext)[source]

Split extended config into normal config and resource value.

Parameters:

config_ext (Dict[str, Union[int, float, str]]) – Extended config

Return type:

(Dict[str, Union[int, float, str]], int)

Returns:

(config, resource_value)

get_resource(config_ext)[source]
Parameters:

config_ext (Dict[str, Union[int, float, str]]) – Extended config

Return type:

int

Returns:

Value of resource attribute