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 sampled during the optimization process,)

  • Also (details depend on the used maximizer.)

  • maximize. (the number of configurations that is returned by calling)

  • 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 & number of configurations to be returned. If n_points is not specified, self._challengers is used. Semantics depend on concrete implementation.

  • 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.LocalAndSortedRandomSearch(configspace, acquisition_function=None, challengers=5000, max_steps=None, n_steps_plateau_walk=10, local_search_iterations=10, seed=0, uniform_configspace=None, prior_sampling_fraction=None)[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)

  • 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). Can optionally be given and sampling ratios be defined via the prior_sampling_fraction parameter.

  • 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.

  • 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 (needs `uniform_configspace`to be defined).

  • 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