smac.optimizer.acquisition.maximizer

Classes

AcquisitionFunctionMaximizer(...[, rng])

Abstract class for acquisition maximization.

ChallengerList(challenger_callback, ...[, ...])

Helper class to interleave random configurations in a list of challengers.

DiffOpt(acquisition_function, config_space)

Get candidate solutions via DifferentialEvolutionSolvers.

FixedSet(configurations, ...[, rng])

LocalAndSortedPriorRandomSearch(...[, rng, ...])

Implements SMAC's default acquisition function optimization.

LocalAndSortedRandomSearch(...[, rng, ...])

Implements SMAC's default acquisition function optimization.

LocalSearch(acquisition_function, config_space)

Implementation of SMAC's local search.

RandomSearch(acquisition_function, config_space)

Get candidate solutions via random sampling of configurations.

class smac.optimizer.acquisition.maximizer.AcquisitionFunctionMaximizer(acquisition_function, config_space, rng=None)[source]

Bases: object

Abstract class for acquisition maximization.

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

Parameters
  • acquisition_function (AbstractAcquisitionFunction) –

  • config_space (ConfigurationSpace) –

  • rng (np.random.RandomState or int, optional) –

maximize(runhistory, stats, num_points, random_configuration_chooser=None)[source]

Maximize acquisition function using _maximize.

Parameters
  • runhistory (RunHistory) – runhistory object

  • stats (Stats) – current stats object

  • num_points (int) – number of points to be sampled

  • random_configuration_chooser (RandomConfigurationChooser, optional) – part of the returned ChallengerList such that we can interleave random configurations by a scheme defined by the random_configuration_chooser; random_configuration_chooser.next_smbo_iteration() is called at the end of this function

Returns

An iterable consisting of smac.configspace.Configuration.

Return type

iterable

class smac.optimizer.acquisition.maximizer.ChallengerList(challenger_callback, configuration_space, random_configuration_chooser=<smac.optimizer.configuration_chooser.random_chooser.ChooserNoCoolDown object>)[source]

Bases: Iterator

Helper class to interleave random configurations in a list of challengers.

Provides an iterator which returns a random configuration in each second iteration. Reduces time necessary to generate a list of new challengers as one does not need to sample several hundreds of random configurations in each iteration which are never looked at.

Parameters
  • challenger_callback (Callable) – Callback function which returns a list of challengers (without interleaved random configurations, must a be a closure: https://www.programiz.com/python-programming/closure)

  • configuration_space (ConfigurationSpace) – ConfigurationSpace from which to sample new random configurations.

class smac.optimizer.acquisition.maximizer.DiffOpt(acquisition_function, config_space, rng=None)[source]

Bases: smac.optimizer.acquisition.maximizer.AcquisitionFunctionMaximizer

Get candidate solutions via DifferentialEvolutionSolvers.

Parameters
  • acquisition_function (AbstractAcquisitionFunction) –

  • config_space (ConfigurationSpace) –

  • rng (np.random.RandomState or int, optional) –

class smac.optimizer.acquisition.maximizer.FixedSet(configurations, acquisition_function, config_space, rng=None)[source]

Bases: smac.optimizer.acquisition.maximizer.AcquisitionFunctionMaximizer

class smac.optimizer.acquisition.maximizer.LocalAndSortedPriorRandomSearch(acquisition_function, config_space, uniform_config_space, rng=None, max_steps=None, n_steps_plateau_walk=10, n_sls_iterations=10, prior_sampling_fraction=0.5)[source]

Bases: smac.optimizer.acquisition.maximizer.AcquisitionFunctionMaximizer

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
  • acquisition_function (AbstractAcquisitionFunction) –

  • config_space (ConfigurationSpace) – The original ConfigurationSpace specified by the user

  • uniform_config_space (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)

  • rng (np.random.RandomState or int, optional) –

  • max_steps (int) – [LocalSearch] Maximum number of steps that the local search will perform

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

  • n_sls_iterations (int) – [Local Search] number of local search iterations

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

class smac.optimizer.acquisition.maximizer.LocalAndSortedRandomSearch(acquisition_function, config_space, rng=None, max_steps=None, n_steps_plateau_walk=10, n_sls_iterations=10)[source]

Bases: smac.optimizer.acquisition.maximizer.AcquisitionFunctionMaximizer

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.

Parameters
  • acquisition_function (AbstractAcquisitionFunction) –

  • config_space (ConfigurationSpace) –

  • rng (np.random.RandomState or int, optional) –

  • max_steps (int) – [LocalSearch] Maximum number of steps that the local search will perform

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

  • n_sls_iterations (int) – [Local Search] number of local search iterations

class smac.optimizer.acquisition.maximizer.LocalSearch(acquisition_function, config_space, rng=None, max_steps=None, n_steps_plateau_walk=10, vectorization_min_obtain=2, vectorization_max_obtain=64)[source]

Bases: smac.optimizer.acquisition.maximizer.AcquisitionFunctionMaximizer

Implementation of SMAC’s local search.

Parameters
  • acquisition_function (AbstractAcquisitionFunction) –

  • config_space (ConfigurationSpace) –

  • rng (np.random.RandomState or int, optional) –

  • max_steps (int) – Maximum number of iterations that the local search will perform

  • n_steps_plateau_walk (int) – number of steps during a plateau walk before local search terminates

  • vectorization_min_obtain (int) – 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) – Maximal number of neighbors to obtain at once for each local search for vectorized calls. Can be tuned to reduce the overhead of SMAC

class smac.optimizer.acquisition.maximizer.RandomSearch(acquisition_function, config_space, rng=None)[source]

Bases: smac.optimizer.acquisition.maximizer.AcquisitionFunctionMaximizer

Get candidate solutions via random sampling of configurations.

Parameters
  • acquisition_function (AbstractAcquisitionFunction) –

  • config_space (ConfigurationSpace) –

  • rng (np.random.RandomState or int, optional) –