class smac.optimizer.smbo.SMBO(scenario: smac.scenario.scenario.Scenario, stats: smac.stats.stats.Stats, initial_design: smac.initial_design.initial_design.InitialDesign, runhistory: smac.runhistory.runhistory.RunHistory, runhistory2epm: smac.runhistory.runhistory2epm.AbstractRunHistory2EPM, intensifier: smac.intensification.abstract_racer.AbstractRacer, num_run: int, model: smac.epm.base_epm.AbstractEPM, acq_optimizer: smac.optimizer.ei_optimization.AcquisitionFunctionMaximizer, acquisition_func: smac.optimizer.acquisition.AbstractAcquisitionFunction, rng: numpy.random.mtrand.RandomState, tae_runner: smac.tae.base.BaseRunner, restore_incumbent: Optional[ConfigSpace.configuration_space.Configuration] = None, random_configuration_chooser: smac.optimizer.random_configuration_chooser.RandomConfigurationChooser = <smac.optimizer.random_configuration_chooser.ChooserNoCoolDown object>, predict_x_best: bool = True, min_samples_model: int = 1)

Bases: object

Interface that contains the main Bayesian optimization loop

  • scenario (smac.scenario.scenario.Scenario) – Scenario object

  • stats (Stats) – statistics object with configuration budgets

  • initial_design (InitialDesign) – initial sampling design

  • runhistory (RunHistory) – runhistory with all runs so far

  • runhistory2epm (AbstractRunHistory2EPM) – Object that implements the AbstractRunHistory2EPM to convert runhistory data into EPM data

  • intensifier (Intensifier) – intensification of new challengers against incumbent configuration (probably with some kind of racing on the instances)

  • num_run (int) – id of this run (used for pSMAC)

  • model (AbstractEPM) – empirical performance model

  • acq_optimizer (AcquisitionFunctionMaximizer) – Optimizer of acquisition function.

  • acquisition_func (AcquisitionFunction) – Object that implements the AbstractAcquisitionFunction (i.e., infill criterion for acq_optimizer)

  • restore_incumbent (Configuration) – incumbent to be used from the start. ONLY used to restore states.

  • rng (np.random.RandomState) – Random number generator

  • tae_runner (smac.tae.base.BaseRunner Object) – target algorithm run executor

  • random_configuration_chooser – Chooser for random configuration – one of * ChooserNoCoolDown(modulus) * ChooserLinearCoolDown(start_modulus, modulus_increment, end_modulus)

  • predict_x_best (bool) – Choose x_best for computing the acquisition function via the model instead of via the observations.

  • min_samples_model (int) – Minimum number of samples to build a model.

_get_timebound_for_intensification(time_spent: float, update: bool) float

Calculate time left for intensify from the time spent on choosing challengers using the fraction of time intended for intensification (which is specified in scenario.intensification_percentage).

  • time_spent (float) –

  • update (bool) – Only used to check in the unit tests how this function was called



Return type


_incorporate_run_results(run_info: smac.runhistory.runhistory.RunInfo, result: smac.runhistory.runhistory.RunValue, time_left: float) None

The SMBO submits a config-run-request via a RunInfo object. When that config run is completed, a RunValue, which contains all the relevant information obtained after running a job, is returned. This method incorporates the status of that run into the stats/runhistory objects so that other consumers can advance with their task.

Additionally, it checks for a new incumbent via the intensifier process results, which also has the side effect of moving the intensifier to a new state

  • run_info (RunInfo) – Describes the run (config) from which to process the results

  • result (RunValue) – Contains relevant information regarding the execution of a config

  • time_left (float) – time in [sec] available to perform intensify

run() ConfigSpace.configuration_space.Configuration

Runs the Bayesian optimization loop


incumbent – The best found configuration

Return type

np.array(1, H)

save() None

Saves the current stats and runhistory.

start() None

Starts the Bayesian Optimization loop. Detects whether the optimization is restored from a previous state.

validate(config_mode: Union[str, List[ConfigSpace.configuration_space.Configuration]] = 'inc', instance_mode: Union[str, List[str]] = 'train+test', repetitions: int = 1, use_epm: bool = False, n_jobs: int = - 1, backend: str = 'threading') smac.runhistory.runhistory.RunHistory

Create validator-object and run validation, using scenario-information, runhistory from smbo and tae_runner from intensify

  • config_mode (str or list<Configuration>) – string or directly a list of Configuration str from [def, inc, def+inc, wallclock_time, cpu_time, all] time evaluates at cpu- or wallclock-timesteps of: [max_time/2^0, max_time/2^1, max_time/2^3, …, default] with max_time being the highest recorded time

  • instance_mode (string) – what instances to use for validation, from [train, test, train+test]

  • repetitions (int) – number of repetitions in nondeterministic algorithms (in deterministic will be fixed to 1)

  • use_epm (bool) – whether to use an EPM instead of evaluating all runs with the TAE

  • n_jobs (int) – number of parallel processes used by joblib


runhistory – runhistory containing all specified runs

Return type