smac.optimizer.ei_optimization module

class smac.optimizer.ei_optimization.AcquisitionFunctionMaximizer(acquisition_function: smac.optimizer.acquisition.AbstractAcquisitionFunction, config_space: ConfigSpace.configuration_space.ConfigurationSpace, rng: typing.Union[bool, mtrand.RandomState] = 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: smac.runhistory.runhistory.RunHistory, stats: smac.stats.stats.Stats, num_points: int) → typing.Iterable[ConfigSpace.configuration_space.Configuration][source]

Maximize acquisition function using _maximize.

Parameters:
Returns:

An iterable consisting of smac.configspace.Configuration.

Return type:

iterable

class smac.optimizer.ei_optimization.ChallengerList(challengers, configuration_space)[source]

Bases: object

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:
  • challengers (list) – List of challengers (without interleaved random configurations)
  • configuration_space (ConfigurationSpace) – ConfigurationSpace from which to sample new random configurations.
class smac.optimizer.ei_optimization.InterleavedLocalAndRandomSearch(acquisition_function: smac.optimizer.acquisition.AbstractAcquisitionFunction, config_space: ConfigSpace.configuration_space.ConfigurationSpace, rng: typing.Union[bool, mtrand.RandomState] = None)[source]

Bases: smac.optimizer.ei_optimization.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 and interleaves unsorted, randomly sampled configurations in between.

Parameters:
  • acquisition_function (AbstractAcquisitionFunction) –
  • config_space (ConfigurationSpace) –
  • rng (np.random.RandomState or int, optional) –
maximize(runhistory: smac.runhistory.runhistory.RunHistory, stats: smac.stats.stats.Stats, num_points: int, *args) → typing.Iterable[ConfigSpace.configuration_space.Configuration][source]
class smac.optimizer.ei_optimization.LocalSearch(acquisition_function: smac.optimizer.acquisition.AbstractAcquisitionFunction, config_space: ConfigSpace.configuration_space.ConfigurationSpace, rng: typing.Union[bool, mtrand.RandomState] = None, epsilon: float = 1e-05, max_iterations: typing.Union[int, NoneType] = None)[source]

Bases: smac.optimizer.ei_optimization.AcquisitionFunctionMaximizer

Implementation of SMAC’s local search.

Parameters:
  • acquisition_function (AbstractAcquisitionFunction) –
  • config_space (ConfigurationSpace) –
  • rng (np.random.RandomState or int, optional) –
  • epsilon (float) – In order to perform a local move one of the incumbent’s neighbors needs at least an improvement higher than epsilon
  • max_iterations (int) – Maximum number of iterations that the local search will perform
maximize(runhistory: smac.runhistory.runhistory.RunHistory, stats: smac.stats.stats.Stats, num_points: int) → typing.Iterable[ConfigSpace.configuration_space.Configuration]

Maximize acquisition function using _maximize.

Parameters:
Returns:

An iterable consisting of smac.configspace.Configuration.

Return type:

iterable

class smac.optimizer.ei_optimization.RandomSearch(acquisition_function: smac.optimizer.acquisition.AbstractAcquisitionFunction, config_space: ConfigSpace.configuration_space.ConfigurationSpace, rng: typing.Union[bool, mtrand.RandomState] = None)[source]

Bases: smac.optimizer.ei_optimization.AcquisitionFunctionMaximizer

Get candidate solutions via random sampling of configurations.

Parameters:
  • acquisition_function (AbstractAcquisitionFunction) –
  • config_space (ConfigurationSpace) –
  • rng (np.random.RandomState or int, optional) –
maximize(runhistory: smac.runhistory.runhistory.RunHistory, stats: smac.stats.stats.Stats, num_points: int) → typing.Iterable[ConfigSpace.configuration_space.Configuration]

Maximize acquisition function using _maximize.

Parameters:
Returns:

An iterable consisting of smac.configspace.Configuration.

Return type:

iterable