smac.acquisition.maximizer

Interfaces

class smac.acquisition.maximizer.AbstractAcquisitionMaximizer(configspace, acquisition_function=None, challengers=5000, seed=0)[source]

Bases: object

Abstract class for the acquisition maximization.

In order to use this class it has to be subclassed and the method _maximize must be implemented.

Parameters:
  • configspace (ConfigurationSpace) –

  • acquisition_function (AbstractAcquisitionFunction) –

  • challengers (int, defaults to 5000) – Number of configurations to sample from the configuration space to get the acquisition function value for, thus challenging the current incumbent and becoming a candidate for the next function evaluation.

  • seed (int, defaults to 0) –

property acquisition_function: AbstractAcquisitionFunction | None

The acquisition function used for maximization.

maximize(previous_configs, n_points=None, random_design=None)[source]

Maximize acquisition function using _maximize, implemented by a subclass.

Parameters:
  • previous_configs (list[Configuration]) – Previous evaluated configurations.

  • n_points (int, defaults to None) – Number of points to be sampled. If n_points is not specified, self._challengers is used.

  • random_design (AbstractRandomDesign, defaults to None) – Part of the returned ChallengerList such that we can interleave random configurations by a scheme defined by the random design. The method random_design.next_iteration() is called at the end of this function.

Returns:

challengers – An iterable consisting of configurations.

Return type:

Iterator[Configuration]

property meta: dict[str, Any]

Return the meta-data of the created object.

class smac.acquisition.maximizer.DifferentialEvolution(configspace, acquisition_function=None, challengers=5000, seed=0)[source]

Bases: AbstractAcquisitionMaximizer

Get candidate solutions via DifferentialEvolutionSolvers from scipy.

According to scipy 1.9.2 documentation:

‘Finds the global minimum of a multivariate function. Differential Evolution is stochastic in nature (does not use gradient methods) to find the minimum, and can search large areas of candidate space, but often requires larger numbers of function evaluations than conventional gradient-based techniques. The algorithm is due to Storn and Price [1].’

[1] Storn, R and Price, K, Differential Evolution - a Simple and Efficient Heuristic for Global

Optimization over Continuous Spaces, Journal of Global Optimization, 1997, 11, 341 - 359.

class smac.acquisition.maximizer.LocalAndSortedPriorRandomSearch(configspace, uniform_configspace, acquisition_function=None, challengers=5000, max_steps=None, n_steps_plateau_walk=10, local_search_iterations=10, prior_sampling_fraction=0.5, seed=0)[source]

Bases: AbstractAcquisitionMaximizer

Implements SMAC’s default acquisition function optimization.

This optimizer performs local search from the previous best points according to the acquisition function, uses the acquisition function to sort randomly sampled configurations. Random configurations are interleaved by the main SMAC code. The random configurations are retrieved from two different ConfigurationSpaces - one which uses priors (e.g. NormalFloatHP) and is defined by the user, and one that is a uniform version of the same space, i.e. with the priors removed.

Parameters:
  • configspace (ConfigurationSpace) – The original ConfigurationSpace specified by the user.

  • uniform_configspace (ConfigurationSpace) – A version of the user-defined ConfigurationSpace where all parameters are uniform (or have their weights removed in the case of a categorical hyperparameter).

  • acquisition_function (AbstractAcquisitionFunction | None, defaults to None) –

  • challengers (int, defaults to 5000) – Number of challengers.

  • max_steps (int, defaults to None) – [LocalSearch] Maximum number of steps that the local search will perform.

  • n_steps_plateau_walk (int, defaults to 10) – [LocalSearch] number of steps during a plateau walk before local search terminates.

  • local_search_iterations (int, defaults to 10) – [Local Search] number of local search iterations.

  • prior_sampling_fraction (float, defaults to 0.5) – The ratio of random samples that are taken from the user-defined ConfigurationSpace, as opposed to the uniform version.

  • seed (int, defaults to 0) –

class smac.acquisition.maximizer.LocalAndSortedRandomSearch(configspace, acquisition_function=None, challengers=5000, max_steps=None, n_steps_plateau_walk=10, local_search_iterations=10, seed=0)[source]

Bases: AbstractAcquisitionMaximizer

Implement SMAC’s default acquisition function optimization.

This optimizer performs local search from the previous best points according, to the acquisition function, uses the acquisition function to sort randomly sampled configurations. Random configurations are interleaved by the main SMAC code.

The Random configurations are interleaved to circumvent issues from a constant prediction from the Random Forest model at the beginning of the optimization process.

Parameters:
  • configspace (ConfigurationSpace) –

  • acquisition_function (AbstractAcquisitionFunction | None, defaults to None) –

  • challengers (int, defaults to 5000) – Number of challengers.

  • max_steps (int | None, defaults to None) – [LocalSearch] Maximum number of steps that the local search will perform.

  • n_steps_plateau_walk (int, defaults to 10) – [LocalSearch] number of steps during a plateau walk before local search terminates.

  • local_search_iterations (int, defauts to 10) – [Local Search] number of local search iterations.

  • seed (int, defaults to 0) –

property acquisition_function: AbstractAcquisitionFunction | None

Returns the used acquisition function.

property meta: dict[str, Any]

Return the meta-data of the created object.

class smac.acquisition.maximizer.LocalSearch(configspace, acquisition_function=None, challengers=5000, max_steps=None, n_steps_plateau_walk=10, vectorization_min_obtain=2, vectorization_max_obtain=64, seed=0)[source]

Bases: AbstractAcquisitionMaximizer

Implementation of SMAC’s local search.

Parameters:
  • configspace (ConfigurationSpace) –

  • acquisition_function (AbstractAcquisitionFunction) –

  • challengers (int, defaults to 5000) – Number of challengers.

  • max_steps (int | None, defaults to None) – Maximum number of iterations that the local search will perform.

  • n_steps_plateau_walk (int, defaults to 10) – Number of steps during a plateau walk before local search terminates.

  • vectorization_min_obtain (int, defaults to 2) – Minimal number of neighbors to obtain at once for each local search for vectorized calls. Can be tuned to reduce the overhead of SMAC.

  • vectorization_max_obtain (int, defaults to 64) – Maximal number of neighbors to obtain at once for each local search for vectorized calls. Can be tuned to reduce the overhead of SMAC.

  • seed (int, defaults to 0) –

property meta: dict[str, Any]

Return the meta-data of the created object.

class smac.acquisition.maximizer.RandomSearch(configspace, acquisition_function=None, challengers=5000, seed=0)[source]

Bases: AbstractAcquisitionMaximizer

Get candidate solutions via random sampling of configurations.

Modules

smac.acquisition.maximizer.abstract_acqusition_maximizer

smac.acquisition.maximizer.differential_evolution

smac.acquisition.maximizer.helpers

smac.acquisition.maximizer.local_and_random_search

smac.acquisition.maximizer.local_search

smac.acquisition.maximizer.random_search