smac.runhistory.runhistory2epm module

class smac.runhistory.runhistory2epm.AbstractRunHistory2EPM(scenario: smac.scenario.scenario.Scenario, num_params: int, success_states: List[smac.tae.StatusType], impute_censored_data: bool = False, impute_state: Optional[List[smac.tae.StatusType]] = None, consider_for_higher_budgets_state: Optional[List[smac.tae.StatusType]] = None, imputor: Optional[smac.epm.base_imputor.BaseImputor] = None, scale_perc: int = 5, rng: Optional[numpy.random.mtrand.RandomState] = None)[source]

Bases: object

Constructor

Parameters
  • scenario (Scenario Object) – Algorithm Configuration Scenario

  • num_params (int) – number of parameters in config space

  • success_states (list, optional) – List of states considered as successful (such as StatusType.SUCCESS) If None, set to [StatusType.SUCCESS, ]

  • impute_censored_data (bool, optional) – Should we impute data?

  • consider_for_higher_budgets_state (list, optional) – Additionally consider all runs with these states for budget < current budget

  • imputor (epm.base_imputor Instance) – Object to impute censored data

  • impute_state (list, optional) – List of states that mark censored data (such as StatusType.TIMEOUT) in combination with runtime < cutoff_time If None, set to [StatusType.CAPPED, ]

  • scale_perc (int) – scaled y-transformation use a percentile to estimate distance to optimum; only used by some subclasses of AbstractRunHistory2EPM

  • rng (numpy.random.RandomState) – only used for reshuffling data after imputation

abstract _build_matrix(run_dict: Mapping[smac.runhistory.runhistory.RunKey, smac.runhistory.runhistory.RunValue], runhistory: smac.runhistory.runhistory.RunHistory, return_time_as_y: bool = False, store_statistics: bool = False) → Tuple[numpy.ndarray, numpy.ndarray][source]

Builds x,y matrixes from selected runs from runhistory

Parameters
  • run_dict (dict(RunKey -> RunValue)) – dictionary from RunHistory.RunKey to RunHistory.RunValue

  • runhistory (RunHistory) – runhistory object

  • return_time_as_y (bool) – Return the time instead of cost as y value. Necessary to access the raw y values for imputation.

  • store_statistics (bool) – Whether to store statistics about the data (to be used at subsequent calls)

Returns

  • X (np.ndarray)

  • Y (np.ndarray)

_get_s_run_dict(runhistory: smac.runhistory.runhistory.RunHistory, budget_subset: Optional[List] = None) → Dict[smac.runhistory.runhistory.RunKey, smac.runhistory.runhistory.RunValue][source]
_get_t_run_dict(runhistory: smac.runhistory.runhistory.RunHistory, budget_subset: Optional[List] = None) → Dict[smac.runhistory.runhistory.RunKey, smac.runhistory.runhistory.RunValue][source]
get_X_y(runhistory: smac.runhistory.runhistory.RunHistory) → Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray][source]

Simple interface to obtain all data in runhistory in X, y format Note: This function should not be used as it does not consider all available StatusTypes

Parameters

runhistory (smac.runhistory.runhistory.RunHistory) – runhistory of all evaluated configurations x instances

Returns

  • X (numpy.ndarray) – matrix of all configurations (+ instance features)

  • y (numpy.ndarray) – vector of cost values; can include censored runs

  • cen (numpy.ndarray) – vector of bools indicating whether the y-value is censored

get_configurations(runhistory: smac.runhistory.runhistory.RunHistory, budget_subset: Optional[List] = None) → numpy.ndarray[source]

Returns vector representation of only the configurations.

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

Parameters
Returns

Return type

numpy.ndarray

transform(runhistory: smac.runhistory.runhistory.RunHistory, budget_subset: Optional[List] = None) → Tuple[numpy.ndarray, numpy.ndarray][source]

Returns vector representation of runhistory; if imputation is disabled, censored (TIMEOUT with time < cutoff) will be skipped

Parameters
Returns

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

  • Y (numpy.ndarray) – cost values

abstract transform_response_values(values: numpy.ndarray) → numpy.ndarray[source]

Transform function response values.

Parameters

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

Returns

Return type

np.ndarray

class smac.runhistory.runhistory2epm.RunHistory2EPM4Cost(scenario: smac.scenario.scenario.Scenario, num_params: int, success_states: List[smac.tae.StatusType], impute_censored_data: bool = False, impute_state: Optional[List[smac.tae.StatusType]] = None, consider_for_higher_budgets_state: Optional[List[smac.tae.StatusType]] = None, imputor: Optional[smac.epm.base_imputor.BaseImputor] = None, scale_perc: int = 5, rng: Optional[numpy.random.mtrand.RandomState] = None)[source]

Bases: smac.runhistory.runhistory2epm.AbstractRunHistory2EPM

TODO

Constructor

Parameters
  • scenario (Scenario Object) – Algorithm Configuration Scenario

  • num_params (int) – number of parameters in config space

  • success_states (list, optional) – List of states considered as successful (such as StatusType.SUCCESS) If None, set to [StatusType.SUCCESS, ]

  • impute_censored_data (bool, optional) – Should we impute data?

  • consider_for_higher_budgets_state (list, optional) – Additionally consider all runs with these states for budget < current budget

  • imputor (epm.base_imputor Instance) – Object to impute censored data

  • impute_state (list, optional) – List of states that mark censored data (such as StatusType.TIMEOUT) in combination with runtime < cutoff_time If None, set to [StatusType.CAPPED, ]

  • scale_perc (int) – scaled y-transformation use a percentile to estimate distance to optimum; only used by some subclasses of AbstractRunHistory2EPM

  • rng (numpy.random.RandomState) – only used for reshuffling data after imputation

_build_matrix(run_dict: Mapping[smac.runhistory.runhistory.RunKey, smac.runhistory.runhistory.RunValue], runhistory: smac.runhistory.runhistory.RunHistory, return_time_as_y: bool = False, store_statistics: bool = False) → Tuple[numpy.ndarray, numpy.ndarray][source]

“Builds X,y matrixes from selected runs from runhistory

Parameters
  • run_dict (dict: RunKey -> RunValue) – dictionary from RunHistory.RunKey to RunHistory.RunValue

  • runhistory (RunHistory) – runhistory object

  • return_time_as_y (bool) – Return the time instead of cost as y value. Necessary to access the raw y values for imputation.

  • store_statistics (bool) – Whether to store statistics about the data (to be used at subsequent calls)

Returns

  • X (np.ndarray)

  • Y (np.ndarray)

transform_response_values(values: numpy.ndarray) → numpy.ndarray[source]

Transform function response values.

Returns the input values.

Parameters

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

Returns

Return type

np.ndarray

class smac.runhistory.runhistory2epm.RunHistory2EPM4EIPS(scenario: smac.scenario.scenario.Scenario, num_params: int, success_states: List[smac.tae.StatusType], impute_censored_data: bool = False, impute_state: Optional[List[smac.tae.StatusType]] = None, consider_for_higher_budgets_state: Optional[List[smac.tae.StatusType]] = None, imputor: Optional[smac.epm.base_imputor.BaseImputor] = None, scale_perc: int = 5, rng: Optional[numpy.random.mtrand.RandomState] = None)[source]

Bases: smac.runhistory.runhistory2epm.AbstractRunHistory2EPM

TODO

Constructor

Parameters
  • scenario (Scenario Object) – Algorithm Configuration Scenario

  • num_params (int) – number of parameters in config space

  • success_states (list, optional) – List of states considered as successful (such as StatusType.SUCCESS) If None, set to [StatusType.SUCCESS, ]

  • impute_censored_data (bool, optional) – Should we impute data?

  • consider_for_higher_budgets_state (list, optional) – Additionally consider all runs with these states for budget < current budget

  • imputor (epm.base_imputor Instance) – Object to impute censored data

  • impute_state (list, optional) – List of states that mark censored data (such as StatusType.TIMEOUT) in combination with runtime < cutoff_time If None, set to [StatusType.CAPPED, ]

  • scale_perc (int) – scaled y-transformation use a percentile to estimate distance to optimum; only used by some subclasses of AbstractRunHistory2EPM

  • rng (numpy.random.RandomState) – only used for reshuffling data after imputation

_build_matrix(run_dict: Mapping[smac.runhistory.runhistory.RunKey, smac.runhistory.runhistory.RunValue], runhistory: smac.runhistory.runhistory.RunHistory, return_time_as_y: bool = False, store_statistics: bool = False) → Tuple[numpy.ndarray, numpy.ndarray][source]

TODO

transform_response_values(values: numpy.ndarray) → Tuple[numpy.ndarray][source]

Transform function response values.

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

Parameters

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

Returns

Return type

np.ndarray

class smac.runhistory.runhistory2epm.RunHistory2EPM4InvScaledCost(**kwargs)[source]

Bases: smac.runhistory.runhistory2epm.RunHistory2EPM4Cost

TODO

Constructor

Parameters
  • scenario (Scenario Object) – Algorithm Configuration Scenario

  • num_params (int) – number of parameters in config space

  • success_states (list, optional) – List of states considered as successful (such as StatusType.SUCCESS) If None, set to [StatusType.SUCCESS, ]

  • impute_censored_data (bool, optional) – Should we impute data?

  • consider_for_higher_budgets_state (list, optional) – Additionally consider all runs with these states for budget < current budget

  • imputor (epm.base_imputor Instance) – Object to impute censored data

  • impute_state (list, optional) – List of states that mark censored data (such as StatusType.TIMEOUT) in combination with runtime < cutoff_time If None, set to [StatusType.CAPPED, ]

  • scale_perc (int) – scaled y-transformation use a percentile to estimate distance to optimum; only used by some subclasses of AbstractRunHistory2EPM

  • rng (numpy.random.RandomState) – only used for reshuffling data after imputation

transform_response_values(values: numpy.ndarray) → numpy.ndarray[source]

Transform function response values.

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

Parameters

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

Returns

Return type

np.ndarray

class smac.runhistory.runhistory2epm.RunHistory2EPM4LogCost(scenario: smac.scenario.scenario.Scenario, num_params: int, success_states: List[smac.tae.StatusType], impute_censored_data: bool = False, impute_state: Optional[List[smac.tae.StatusType]] = None, consider_for_higher_budgets_state: Optional[List[smac.tae.StatusType]] = None, imputor: Optional[smac.epm.base_imputor.BaseImputor] = None, scale_perc: int = 5, rng: Optional[numpy.random.mtrand.RandomState] = None)[source]

Bases: smac.runhistory.runhistory2epm.RunHistory2EPM4Cost

TODO

Constructor

Parameters
  • scenario (Scenario Object) – Algorithm Configuration Scenario

  • num_params (int) – number of parameters in config space

  • success_states (list, optional) – List of states considered as successful (such as StatusType.SUCCESS) If None, set to [StatusType.SUCCESS, ]

  • impute_censored_data (bool, optional) – Should we impute data?

  • consider_for_higher_budgets_state (list, optional) – Additionally consider all runs with these states for budget < current budget

  • imputor (epm.base_imputor Instance) – Object to impute censored data

  • impute_state (list, optional) – List of states that mark censored data (such as StatusType.TIMEOUT) in combination with runtime < cutoff_time If None, set to [StatusType.CAPPED, ]

  • scale_perc (int) – scaled y-transformation use a percentile to estimate distance to optimum; only used by some subclasses of AbstractRunHistory2EPM

  • rng (numpy.random.RandomState) – only used for reshuffling data after imputation

transform_response_values(values: numpy.ndarray) → numpy.ndarray[source]

Transform function response values.

Transforms the response values by using a log transformation.

Parameters

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

Returns

Return type

np.ndarray

class smac.runhistory.runhistory2epm.RunHistory2EPM4LogScaledCost(scenario: smac.scenario.scenario.Scenario, num_params: int, success_states: List[smac.tae.StatusType], impute_censored_data: bool = False, impute_state: Optional[List[smac.tae.StatusType]] = None, consider_for_higher_budgets_state: Optional[List[smac.tae.StatusType]] = None, imputor: Optional[smac.epm.base_imputor.BaseImputor] = None, scale_perc: int = 5, rng: Optional[numpy.random.mtrand.RandomState] = None)[source]

Bases: smac.runhistory.runhistory2epm.RunHistory2EPM4Cost

TODO

Constructor

Parameters
  • scenario (Scenario Object) – Algorithm Configuration Scenario

  • num_params (int) – number of parameters in config space

  • success_states (list, optional) – List of states considered as successful (such as StatusType.SUCCESS) If None, set to [StatusType.SUCCESS, ]

  • impute_censored_data (bool, optional) – Should we impute data?

  • consider_for_higher_budgets_state (list, optional) – Additionally consider all runs with these states for budget < current budget

  • imputor (epm.base_imputor Instance) – Object to impute censored data

  • impute_state (list, optional) – List of states that mark censored data (such as StatusType.TIMEOUT) in combination with runtime < cutoff_time If None, set to [StatusType.CAPPED, ]

  • scale_perc (int) – scaled y-transformation use a percentile to estimate distance to optimum; only used by some subclasses of AbstractRunHistory2EPM

  • rng (numpy.random.RandomState) – only used for reshuffling data after imputation

transform_response_values(values: numpy.ndarray) → numpy.ndarray[source]

Transform function response values.

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

Parameters

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

Returns

Return type

np.ndarray

class smac.runhistory.runhistory2epm.RunHistory2EPM4ScaledCost(scenario: smac.scenario.scenario.Scenario, num_params: int, success_states: List[smac.tae.StatusType], impute_censored_data: bool = False, impute_state: Optional[List[smac.tae.StatusType]] = None, consider_for_higher_budgets_state: Optional[List[smac.tae.StatusType]] = None, imputor: Optional[smac.epm.base_imputor.BaseImputor] = None, scale_perc: int = 5, rng: Optional[numpy.random.mtrand.RandomState] = None)[source]

Bases: smac.runhistory.runhistory2epm.RunHistory2EPM4Cost

TODO

Constructor

Parameters
  • scenario (Scenario Object) – Algorithm Configuration Scenario

  • num_params (int) – number of parameters in config space

  • success_states (list, optional) – List of states considered as successful (such as StatusType.SUCCESS) If None, set to [StatusType.SUCCESS, ]

  • impute_censored_data (bool, optional) – Should we impute data?

  • consider_for_higher_budgets_state (list, optional) – Additionally consider all runs with these states for budget < current budget

  • imputor (epm.base_imputor Instance) – Object to impute censored data

  • impute_state (list, optional) – List of states that mark censored data (such as StatusType.TIMEOUT) in combination with runtime < cutoff_time If None, set to [StatusType.CAPPED, ]

  • scale_perc (int) – scaled y-transformation use a percentile to estimate distance to optimum; only used by some subclasses of AbstractRunHistory2EPM

  • rng (numpy.random.RandomState) – only used for reshuffling data after imputation

transform_response_values(values: numpy.ndarray) → numpy.ndarray[source]

Transform function response values.

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

Parameters

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

Returns

Return type

np.ndarray

class smac.runhistory.runhistory2epm.RunHistory2EPM4SqrtScaledCost(**kwargs)[source]

Bases: smac.runhistory.runhistory2epm.RunHistory2EPM4Cost

TODO

Constructor

Parameters
  • scenario (Scenario Object) – Algorithm Configuration Scenario

  • num_params (int) – number of parameters in config space

  • success_states (list, optional) – List of states considered as successful (such as StatusType.SUCCESS) If None, set to [StatusType.SUCCESS, ]

  • impute_censored_data (bool, optional) – Should we impute data?

  • consider_for_higher_budgets_state (list, optional) – Additionally consider all runs with these states for budget < current budget

  • imputor (epm.base_imputor Instance) – Object to impute censored data

  • impute_state (list, optional) – List of states that mark censored data (such as StatusType.TIMEOUT) in combination with runtime < cutoff_time If None, set to [StatusType.CAPPED, ]

  • scale_perc (int) – scaled y-transformation use a percentile to estimate distance to optimum; only used by some subclasses of AbstractRunHistory2EPM

  • rng (numpy.random.RandomState) – only used for reshuffling data after imputation

transform_response_values(values: numpy.ndarray) → numpy.ndarray[source]

Transform function response values.

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

Parameters

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

Returns

Return type

np.ndarray