mlos_core.spaces.adapters.llamatune.LlamaTuneAdapter

class mlos_core.spaces.adapters.llamatune.LlamaTuneAdapter(*, orig_parameter_space: ConfigurationSpace, num_low_dims: int = 16, special_param_values: dict | None = None, max_unique_values_per_param: int | None = 10000, use_approximate_reverse_mapping: bool = False)

Implementation of LlamaTune, a set of parameter space transformation techniques, aimed at improving the sample-efficiency of the underlying optimizer.

Attributes:
orig_parameter_space

Original (user-provided) parameter space to explore.

target_parameter_space

Get the parameter space, which is explored by the underlying optimizer.

Methods

inverse_transform(configurations)

Translates a configuration, which belongs to the original parameter space, to the target parameter space.

transform(configuration)

Translates a configuration, which belongs to the target parameter space, to the original parameter space.

__init__(*, orig_parameter_space: ConfigurationSpace, num_low_dims: int = 16, special_param_values: dict | None = None, max_unique_values_per_param: int | None = 10000, use_approximate_reverse_mapping: bool = False)

Create a space adapter that employs LlamaTune’s techniques.

Parameters:
orig_parameter_spaceConfigSpace.ConfigurationSpace

The original (user-provided) parameter space to optimize.

num_low_dims: int

Number of dimensions used in the low-dimensional parameter search space.

special_param_values_dict: Optional[dict]

Dictionary of special

max_unique_values_per_param: Optional[int]:

Number of unique values per parameter. Used to discretize the parameter space. If None space discretization is disabled.

DEFAULT_MAX_UNIQUE_VALUES_PER_PARAM = 10000

Default number of (max) unique values of each parameter, when space discretization is used.

DEFAULT_NUM_LOW_DIMS = 16

Default number of dimensions in the low-dimensional search space, generated by HeSBO projection.

DEFAULT_SPECIAL_PARAM_VALUE_BIASING_PERCENTAGE = 0.2

Default percentage of bias for each special parameter value.

inverse_transform(configurations: DataFrame) DataFrame

Translates a configuration, which belongs to the original parameter space, to the target parameter space. This method is called by the register method of the BaseOptimizer class, and performs the inverse operation of BaseSpaceAdapter.transform method.

Parameters:
configurationspd.DataFrame

Dataframe of configurations / parameters, which belong to the original parameter space. The columns are the parameter names the original parameter space and the rows are the configurations.

Returns:
configurationspd.DataFrame

Dataframe of the translated configurations / parameters. The columns are the parameter names of the target parameter space and the rows are the configurations.

property target_parameter_space: ConfigurationSpace

Get the parameter space, which is explored by the underlying optimizer.

transform(configuration: DataFrame) DataFrame

Translates a configuration, which belongs to the target parameter space, to the original parameter space. This method is called by the suggest method of the BaseOptimizer class.

Parameters:
configurationpd.DataFrame

Pandas dataframe with a single row. Column names are the parameter names of the target parameter space.

Returns:
configurationpd.DataFrame

Pandas dataframe with a single row, containing the translated configuration. Column names are the parameter names of the original parameter space.