smac.facade.smac_ac_facade module

class smac.facade.smac_ac_facade.SMAC4AC(scenario: smac.scenario.scenario.Scenario, tae_runner: Optional[Union[Type[smac.tae.base.BaseRunner], Callable]] = None, tae_runner_kwargs: Optional[Dict] = None, runhistory: Optional[Union[Type[smac.runhistory.runhistory.RunHistory], smac.runhistory.runhistory.RunHistory]] = None, runhistory_kwargs: Optional[Dict] = None, intensifier: Optional[Type[smac.intensification.abstract_racer.AbstractRacer]] = None, intensifier_kwargs: Optional[Dict] = None, acquisition_function: Optional[Type[smac.optimizer.acquisition.AbstractAcquisitionFunction]] = None, acquisition_function_kwargs: Optional[Dict] = None, integrate_acquisition_function: bool = False, acquisition_function_optimizer: Optional[Type[smac.optimizer.ei_optimization.AcquisitionFunctionMaximizer]] = None, acquisition_function_optimizer_kwargs: Optional[Dict] = None, model: Optional[Type[smac.epm.base_epm.AbstractEPM]] = None, model_kwargs: Optional[Dict] = None, runhistory2epm: Optional[Type[smac.runhistory.runhistory2epm.AbstractRunHistory2EPM]] = None, runhistory2epm_kwargs: Optional[Dict] = None, initial_design: Optional[Type[smac.initial_design.initial_design.InitialDesign]] = None, initial_design_kwargs: Optional[Dict] = None, initial_configurations: Optional[List[ConfigSpace.configuration_space.Configuration]] = None, stats: Optional[smac.stats.stats.Stats] = None, restore_incumbent: Optional[ConfigSpace.configuration_space.Configuration] = None, rng: Optional[Union[int, numpy.random.mtrand.RandomState]] = None, smbo_class: Optional[Type[smac.optimizer.smbo.SMBO]] = None, run_id: Optional[int] = None, random_configuration_chooser: Optional[Type[smac.optimizer.random_configuration_chooser.RandomConfigurationChooser]] = None, random_configuration_chooser_kwargs: Optional[Dict] = None, dask_client: Optional[distributed.client.Client] = None, n_jobs: Optional[int] = 1)[source]

Bases: object

Facade to use SMAC default mode for Algorithm configuration






List with information about previous runs




List of all incumbents




  • scenario (Scenario) – Scenario object

  • tae_runner (BaseRunner or callable) – Callable or implementation of BaseRunner. In case a callable is passed it will be wrapped by ExecuteTAFuncDict. If not set, it will be initialized with the ExecuteTARunOld.

  • tae_runner_kwargs (Optional[Dict]) – arguments passed to constructor of ‘~tae_runner’

  • runhistory (RunHistory) – runhistory to store all algorithm runs

  • runhistory_kwargs (Optional[Dict]) – arguments passed to constructor of runhistory. We strongly advise against changing the aggregation function, since it will break some code assumptions

  • intensifier (Intensifier) – intensification object to issue a racing to decide the current incumbent

  • intensifier_kwargs (Optional[Dict]) – arguments passed to the constructor of ‘~intensifier’

  • acquisition_function (AbstractAcquisitionFunction) – Class or object that implements the AbstractAcquisitionFunction. Will use EI or LogEI if not set. ~acquisition_function_kwargs is passed to the class constructor.

  • acquisition_function_kwargs (Optional[Dict]) – dictionary to pass specific arguments to ~acquisition_function

  • integrate_acquisition_function (bool, default=False) – Whether to integrate the acquisition function. Works only with models which can sample their hyperparameters (i.e. GaussianProcessMCMC).

  • acquisition_function_optimizer (AcquisitionFunctionMaximizer) – Object that implements the AcquisitionFunctionMaximizer. Will use smac.optimizer.ei_optimization.LocalAndSortedRandomSearch if not set.

  • acquisition_function_optimizer_kwargs (Optional[Dict]) – Arguments passed to constructor of ‘~acquisition_function_optimizer’

  • model (AbstractEPM) – Model that implements train() and predict(). Will use a RandomForestWithInstances if not set.

  • model_kwargs (Optional[Dict]) – Arguments passed to constructor of ‘~model’

  • runhistory2epm (RunHistory2EMP) – Object that implements the AbstractRunHistory2EPM. If None, will use RunHistory2EPM4Cost if objective is cost or RunHistory2EPM4LogCost if objective is runtime.

  • runhistory2epm_kwargs (Optional[Dict]) – Arguments passed to the constructor of ‘~runhistory2epm’

  • initial_design (InitialDesign) – initial sampling design

  • initial_design_kwargs (Optional[Dict]) – arguments passed to constructor of `~initial_design’

  • initial_configurations (List[Configuration]) – list of initial configurations for initial design – cannot be used together with initial_design

  • stats (Stats) – optional stats object

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

  • restore_incumbent (Configuration) – incumbent used if restoring to previous state

  • smbo_class (SMBO) – Class implementing the SMBO interface which will be used to instantiate the optimizer class.

  • run_id (int (optional)) – Run ID will be used as subfolder for output_dir. If no run_id is given, a random run_id will be chosen.

  • random_configuration_chooser (RandomConfigurationChooser) – How often to choose a random configuration during the intensification procedure.

  • random_configuration_chooser_kwargs (Optional[Dict]) – arguments of constructor for ‘~random_configuration_chooser’

  • dask_client (dask.distributed.Client) – User-created dask client, can be used to start a dask cluster and then attach SMAC to it.

  • n_jobs (int, optional) – Number of jobs. If > 1 or -1, this creates a dask client if dask_client is None. Will be ignored if dask_client is not None. If None, this value will be set to 1, if -1, this will be set to the number of cpu cores.

Returns the runhistory (i.e., all evaluated configurations and

the results).



Return type



Returns target algorithm evaluator (TAE) object which can run the target algorithm given a configuration



Return type


get_trajectory() → List[][source]

Returns the trajectory (i.e., all incumbent configurations over time).



Return type

List of TrajEntry

optimize() → ConfigSpace.configuration_space.Configuration[source]

Optimizes the algorithm provided in scenario (given in constructor)


incumbent – Best found configuration

Return type


register_callback(callback: Callable) → None[source]

Register a callback function.

Callbacks must implement a class in smac.callbacks and be instantiated objects. They will automatically be registered within SMAC based on which callback class from smac.callbacks they implement.


- Callable (callback) –


Return type


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

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

  • backend (string) – what backend to be used by joblib


runhistory – runhistory containing all specified runs

Return type