Smbo
smac.main.smbo
#
SMBO
#
SMBO(
scenario: Scenario,
runner: AbstractRunner | None,
runhistory: RunHistory,
intensifier: AbstractIntensifier,
overwrite: bool = False,
)
Implementation that contains the main Bayesian optimization loop.
| PARAMETER | DESCRIPTION |
|---|---|
scenario
|
The scenario object, holding all environmental information.
TYPE:
|
runner
|
The runner (containing the target function) is called internally to judge a trial's performance.
In the rare case that
TYPE:
|
runhistory
|
The runhistory stores all trials.
TYPE:
|
intensifier
|
The intensifier decides which trial (combination of configuration, seed, budget and instance) should be run next.
TYPE:
|
overwrite
|
When True, overwrites the run results if a previous run is found that is
inconsistent in the meta data with the current setup. If
TYPE:
|
Warning
This model should be initialized by a facade only.
Source code in smac/main/smbo.py
budget_exhausted
property
#
budget_exhausted: bool
Checks whether the the remaining walltime, cputime or trials was exceeded.
intensifier
property
#
intensifier: AbstractIntensifier
The run history, which is filled with all information during the optimization process.
remaining_cputime
property
#
remaining_cputime: float
Subtracts the target function running budget with the used time.
remaining_trials
property
#
remaining_trials: int
Subtract the target function runs in the scenario with the used ta runs.
remaining_walltime
property
#
remaining_walltime: float
Subtracts the runtime configuration budget with the used wallclock time.
runhistory
property
#
runhistory: RunHistory
The run history, which is filled with all information during the optimization process.
used_target_function_cputime
property
#
used_target_function_cputime: float
Returns how much time the target function spend on the hardware so far.
used_target_function_walltime
property
#
used_target_function_walltime: float
Returns how much walltime the target function spend so far.
ask
#
ask() -> TrialInfo
Asks the intensifier for the next trial.
| RETURNS | DESCRIPTION |
|---|---|
info
|
Information about the trial (config, instance, seed, budget).
TYPE:
|
Source code in smac/main/smbo.py
exists
#
Checks if the files associated with the run already exist. Checks all files that are created by the optimizer.
| PARAMETER | DESCRIPTION |
|---|---|
filename
|
The name of the folder of the SMAC run. |
Source code in smac/main/smbo.py
load
#
Loads the optimizer, intensifier, and runhistory from the output directory specified in the scenario.
Source code in smac/main/smbo.py
optimize
#
Runs the Bayesian optimization loop.
| PARAMETER | DESCRIPTION |
|---|---|
data_to_scatter
|
When a user scatters data from their local process to the distributed network, this data is distributed in a round-robin fashion grouping by number of cores. Roughly speaking, we can keep this data in memory and then we do not have to (de-)serialize the data every time we would like to execute a target function with a big dataset. For example, when your target function has a big dataset shared across all the target function, this argument is very useful. |
| RETURNS | DESCRIPTION |
|---|---|
incumbent
|
The best found configuration.
TYPE:
|
Source code in smac/main/smbo.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | |
print_stats
#
Prints all statistics.
Source code in smac/main/smbo.py
register_callback
#
Registers a callback to be called before, in between, and after the Bayesian optimization loop.
Callback is appended to the list by default.
| PARAMETER | DESCRIPTION |
|---|---|
callback
|
The callback to be registered.
TYPE:
|
index
|
The index at which the callback should be registered. The default is None. If it is None, append the callback to the list.
TYPE:
|
Source code in smac/main/smbo.py
reset
#
Resets the internal variables of the optimizer, intensifier, and runhistory.
Source code in smac/main/smbo.py
save
#
Saves the current stats, runhistory, and intensifier.
Source code in smac/main/smbo.py
tell
#
tell(
info: TrialInfo, value: TrialValue, save: bool = True
) -> None
Adds the result of a trial to the runhistory and updates the stats object.
| PARAMETER | DESCRIPTION |
|---|---|
info
|
Describes the trial from which to process the results.
TYPE:
|
value
|
Contains relevant information regarding the execution of a trial.
TYPE:
|
save
|
Whether the runhistory should be saved.
TYPE:
|
Source code in smac/main/smbo.py
update_acquisition_function
#
update_acquisition_function(
acquisition_function: AbstractAcquisitionFunction,
) -> None
Updates the acquisition function including the associated model and the acquisition optimizer.
Source code in smac/main/smbo.py
update_model
#
update_model(model: AbstractModel) -> None
Updates the model and updates the acquisition function.
Source code in smac/main/smbo.py
validate
#
Validates a configuration on other seeds than the ones used in the optimization process and on the highest budget (if budget type is real-valued). Does not exceed the maximum number of config calls or seeds as defined in the scenario.
| PARAMETER | DESCRIPTION |
|---|---|
config
|
Configuration to validate In case that the budget type is real-valued budget, this argument is ignored.
TYPE:
|
seed
|
If None, the seed from the scenario is used.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
cost
|
The averaged cost of the configuration. In case of multi-fidelity, the cost of each objective is averaged. |