smac.runhistory.encoder

Interfaces

class smac.runhistory.encoder.AbstractRunHistoryEncoder(scenario, considered_states=None, lower_budget_states=None, scale_percentage=5, seed=None)[source]

Bases: object

Abstract class for preparing data in order to train a surrogate model.

Parameters:
  • scenario (Scenario object.)

  • considered_states (list[StatusType], defaults to [StatusType.SUCCESS, StatusType.CRASHED, StatusType.MEMORYOUT] # noqa: E501) – Trials with the passed states are considered.

  • lower_budget_states (list[StatusType], defaults to []) – Additionally consider all trials with these states for budget < current budget.

  • scale_percentage (int, defaults to 5) – Scaled y-transformation use a percentile to estimate distance to optimum. Only used in some sub-classes.

  • seed (int | None, defaults to none)

Raises:

TypeError – If no success states are given.

get_configurations(budget_subset=None)[source]

Returns vector representation of the configurations.

Warning

Instance features are not appended and cost values are not taken into account.

Parameters:

budget_subset (list[int|float] | None, defaults to none) – List of budgets to consider.

Returns:

configs_array

Return type:

np.ndarray

property meta: dict[str, Any]

Returns the meta-data of the created object.

Returns:

  • dict[str, Any] (meta-data of the created object: name, considered states, lower budget)

  • states, scale_percentage, seed.

property multi_objective_algorithm: AbstractMultiObjectiveAlgorithm | None

The multi objective algorithm used to transform the data.

property runhistory: RunHistory

The RunHistory used to transform the data.

transform(budget_subset=None)[source]

Returns a vector representation of the RunHistory.

Parameters:

budget_subset (list | None, defaults to none) – List of budgets to consider.

Return type:

tuple[ndarray, ndarray]

Returns:

  • X (np.ndarray) – Configuration vector and instance features.

  • Y (np.ndarray) – Cost values.

abstract transform_response_values(values)[source]

Transform function response values.

Parameters:

values (np.ndarray) – Response values to be transformed.

Returns:

transformed_values

Return type:

np.ndarray

class smac.runhistory.encoder.RunHistoryEIPSEncoder(scenario, considered_states=None, lower_budget_states=None, scale_percentage=5, seed=None)[source]

Bases: AbstractRunHistoryEncoder

Encoder specifically for the EIPS (expected improvement per second) acquisition function.

transform_response_values(values)[source]

Transform function response values. Transform the runtimes by a log transformation log(1. + runtime).

Parameters:

values (np.ndarray) – Response values to be transformed.

Return type:

np.ndarray

class smac.runhistory.encoder.RunHistoryEncoder(scenario, considered_states=None, lower_budget_states=None, scale_percentage=5, seed=None)[source]

Bases: AbstractRunHistoryEncoder

transform_response_values(values)[source]

Returns the input values.

Return type:

ndarray

class smac.runhistory.encoder.RunHistoryInverseScaledEncoder(*args, **kwargs)[source]

Bases: RunHistoryEncoder

transform_response_values(values)[source]

Transform the response values by linearly scaling them between zero and one and then use inverse scaling.

Return type:

ndarray

class smac.runhistory.encoder.RunHistoryLogEncoder(scenario, considered_states=None, lower_budget_states=None, scale_percentage=5, seed=None)[source]

Bases: RunHistoryEncoder

transform_response_values(values)[source]

Transforms the response values by using log.

Return type:

ndarray

class smac.runhistory.encoder.RunHistoryLogScaledEncoder(scenario, considered_states=None, lower_budget_states=None, scale_percentage=5, seed=None)[source]

Bases: RunHistoryEncoder

transform_response_values(values)[source]

Transform the response values by linearly scaling them between zero and one and then using the log transformation.

Return type:

ndarray

class smac.runhistory.encoder.RunHistoryScaledEncoder(scenario, considered_states=None, lower_budget_states=None, scale_percentage=5, seed=None)[source]

Bases: RunHistoryEncoder

transform_response_values(values)[source]

Transforms the response values by linearly scaling them between zero and one.

Return type:

ndarray

class smac.runhistory.encoder.RunHistorySqrtScaledEncoder(*args, **kwargs)[source]

Bases: RunHistoryEncoder

transform_response_values(values)[source]

Transform the response values by linearly scaling them between zero and one and then using the square root.

Return type:

ndarray

Modules

abstract_encoder

boing_encoder

eips_encoder

encoder

inverse_scaled_encoder

log_encoder

log_scaled_encoder

scaled_encoder

sqrt_scaled_encoder