smac.runhistory.encoder

Interfaces

class smac.runhistory.encoder.AbstractRunHistoryEncoder(scenario, considered_states=[<StatusType.SUCCESS: 1>, <StatusType.CRASHED: 3>, <StatusType.MEMORYOUT: 5>, <StatusType.DONOTADVANCE: 6>], lower_budget_states=[], scale_percentage=5, seed=None)[source]

Bases: object

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

Parameters:
  • scenario (Scenario) –

  • considered_states (list[StatusType], defaults to [StatusType.SUCCESS, StatusType.CRASHED, StatusType.MEMORYOUT, StatusType.DONOTADVANCE] # 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(runhistory, budget_subset=None)[source]

Returns vector representation of the configurations. Instance features are not appended and cost values are not taken into account.

Parameters:
  • runhistory (RunHistory) –

  • budget_subset (list | 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.

Return type:

dict[str, Any]

property multi_objective_algorithm: smac.multi_objective.abstract_multi_objective_algorithm.AbstractMultiObjectiveAlgorithm | None

The multi objecctive algorithm used to transform the data.

Return type:

Optional[AbstractMultiObjectiveAlgorithm]

transform(runhistory, budget_subset=None)[source]

Returns a vector representation of the runhistory.

Parameters:
  • runhistory (RunHistory) –

  • budget_subset (list | None, defauls 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=[<StatusType.SUCCESS: 1>, <StatusType.CRASHED: 3>, <StatusType.MEMORYOUT: 5>, <StatusType.DONOTADVANCE: 6>], lower_budget_states=[], scale_percentage=5, seed=None)[source]

Bases: AbstractRunHistoryEncoder

Encoder specifically for the EIPS 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=[<StatusType.SUCCESS: 1>, <StatusType.CRASHED: 3>, <StatusType.MEMORYOUT: 5>, <StatusType.DONOTADVANCE: 6>], lower_budget_states=[], 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 using inverse scaling.

Return type:

ndarray

class smac.runhistory.encoder.RunHistoryLogEncoder(scenario, considered_states=[<StatusType.SUCCESS: 1>, <StatusType.CRASHED: 3>, <StatusType.MEMORYOUT: 5>, <StatusType.DONOTADVANCE: 6>], lower_budget_states=[], scale_percentage=5, seed=None)[source]

Bases: RunHistoryEncoder

transform_response_values(values)[source]

Transforms the response values by using a log.

Return type:

ndarray

class smac.runhistory.encoder.RunHistoryLogScaledEncoder(scenario, considered_states=[<StatusType.SUCCESS: 1>, <StatusType.CRASHED: 3>, <StatusType.MEMORYOUT: 5>, <StatusType.DONOTADVANCE: 6>], lower_budget_states=[], 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.RunHistoryRawEncoder(scenario, considered_states=[<StatusType.SUCCESS: 1>, <StatusType.CRASHED: 3>, <StatusType.MEMORYOUT: 5>, <StatusType.DONOTADVANCE: 6>], lower_budget_states=[], scale_percentage=5, seed=None)[source]

Bases: RunHistoryEncoder

A transformer that transform the RunHistroy to vectors. This set of classes will return the raw cost values in addition to the transformed cost values. The raw cost values can then be applied for local BO approaches.

transform_raw_values(values)[source]

Returns the raw input values before transformation.

Return type:

ndarray

transform_response_values(values)[source]

Returns the input values.

Return type:

ndarray

transform_with_raw(runhistory, budget_subset=None)[source]

Returns vector representation of runhistory; if imputation is disabled, censored (TIMEOUT with time < cutoff) will be skipped. This function returns both the raw and transformed cost values

Parameters:
Return type:

tuple[ndarray, ndarray, ndarray]

Returns:

  • X (numpy.ndarray) – configuration vector x instance features

  • Y (numpy.ndarray) – cost values

  • Y_raw (numpy.ndarray) – cost values before transformation

class smac.runhistory.encoder.RunHistoryRawScaledEncoder(scenario, considered_states=[<StatusType.SUCCESS: 1>, <StatusType.CRASHED: 3>, <StatusType.MEMORYOUT: 5>, <StatusType.DONOTADVANCE: 6>], lower_budget_states=[], scale_percentage=5, seed=None)[source]

Bases: RunHistoryRawEncoder, RunHistoryLogScaledEncoder

transform_raw_values(values)[source]

Returns the raw input values before transformation.

Return type:

ndarray

class smac.runhistory.encoder.RunHistoryScaledEncoder(scenario, considered_states=[<StatusType.SUCCESS: 1>, <StatusType.CRASHED: 3>, <StatusType.MEMORYOUT: 5>, <StatusType.DONOTADVANCE: 6>], lower_budget_states=[], 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

smac.runhistory.encoder.abstract_encoder

smac.runhistory.encoder.boing_encoder

smac.runhistory.encoder.eips_encoder

smac.runhistory.encoder.encoder

smac.runhistory.encoder.inverse_scaled_encoder

smac.runhistory.encoder.log_encoder

smac.runhistory.encoder.log_scaled_encoder

smac.runhistory.encoder.scaled_encoder

smac.runhistory.encoder.sqrt_scaled_encoder