smac.intensifier.successive_halving_worker¶
Classes¶
|
This is the worker class for Successive Halving. |
Interfaces¶
- class smac.intensifier.successive_halving_worker.SuccessiveHalvingWorker(successive_halving, identifier=0, _all_budgets=None, _n_configs_in_stage=None, _min_budget=None, _max_budget=None)[source]¶
Bases:
AbstractIntensifier
This is the worker class for Successive Halving.
Warning
Do not use this class as stand-alone.
- Parameters:
successive_halving (SuccessiveHalving) – The controller of the instance.
identifier (int, defaults to 0) – Adds a numerical identifier on the instance. Used for debug and tagging logger messages properly.
_all_budgets (np.ndarray | None, defaults to None) – Used internally when HB uses SH as a sub-routing.
_n_configs_in_stage (np.ndarray | None, defaults to None) – Used internally when HB uses SH as a sub-routing.
_min_budget (float | None, defaults to None) – Overwrites the budget from the controller instance if it is not none.
_max_budget (float | None, defaults to None) – Overwrites the budget from the controller instance if it is not none.
- get_next_trial(challengers, incumbent, get_next_configurations, runhistory, repeat_configs=True, n_workers=1)[source]¶
Selects which challenger to use based on the iteration stage and set the iteration parameters. First iteration will choose configurations from the function
get_next_configurations
or input challengers, while the later iterations pick top configurations from the previously selected challengers in that iteration.- Parameters:
challengers (list[Configuration] | None) – Promising configurations.
incumbent (Configuration) – Incumbent configuration.
get_next_configurations (Callable[[], Iterator[Configuration]] | None, defaults to none) – Function that generates next configurations to use for racing.
runhistory (RunHistory) –
repeat_configs (bool, defaults to true) – If false, an evaluated configuration will not be generated again.
n_workers (int, optional, defaults to 1) – The maximum number of workers available.
- Return type:
tuple
[TrialInfoIntent
,TrialInfo
]- Returns:
TrialInfoIntent – Indicator of how to consume the TrialInfo object.
TrialInfo – An object that encapsulates necessary information of the trial.
- get_target_function_budgets()[source]¶
Which budgets are used to call the target function.
- Return type:
list
[Optional
[float
]]
- get_target_function_instances()[source]¶
Which instances are used to call the target function.
- Return type:
list
[Optional
[str
]]
- get_target_function_seeds()[source]¶
Which seeds are used to call the target function.
- Return type:
list
[int
]
- process_results(trial_info, trial_value, incumbent, runhistory, time_bound, log_trajectory=True)[source]¶
The intensifier stage will be updated based on the results/status of a configuration execution. Also, a incumbent will be determined.
- Parameters:
trial_info (TrialInfo) –
trial_value (TrialValue) –
incumbent (Configuration | None) – Best configuration seen so far.
runhistory (RunHistory) –
time_bound (float) – Time [sec] available to perform intensify.
log_trajectory (bool) – Whether to log changes of incumbents in the trajectory.
- Return type:
tuple
[Configuration
,float
]- Returns:
incumbent (Configuration) – Current (maybe new) incumbent configuration.
incumbent_costs (float | list[float]) – Empirical cost(s) of the incumbent configuration.
- property stage: int¶
The current stage of the worker.
- Return type:
int
- property uses_budgets: bool¶
If the intensifier needs to make use of budgets.
- Return type:
bool
- property uses_instances: bool¶
If the intensifier needs to make use of instances.
- Return type:
bool
- property uses_seeds: bool¶
If the intensifier needs to make use of seeds.
- Return type:
bool