smac.optimizer.epm_configuration_chooser module

class smac.optimizer.epm_configuration_chooser.EPMChooser(scenario: smac.scenario.scenario.Scenario, stats: smac.stats.stats.Stats, runhistory: smac.runhistory.runhistory.RunHistory, runhistory2epm: smac.runhistory.runhistory2epm.AbstractRunHistory2EPM, model: smac.epm.rf_with_instances.RandomForestWithInstances, acq_optimizer: smac.optimizer.ei_optimization.AcquisitionFunctionMaximizer, acquisition_func: smac.optimizer.acquisition.AbstractAcquisitionFunction, rng: numpy.random.mtrand.RandomState, restore_incumbent: Optional[ConfigSpace.configuration_space.Configuration] = None, random_configuration_chooser: smac.optimizer.random_configuration_chooser.RandomConfigurationChooser = <smac.optimizer.random_configuration_chooser.ChooserNoCoolDown object>, predict_x_best: bool = True, min_samples_model: int = 1)[source]

Bases: object

Interface to train the EPM and generate next configurations

scenario: smac.scenario.scenario.Scenario

Scenario object

stats: smac.stats.stats.Stats

statistics object with configuration budgets

runhistory: smac.runhistory.runhistory.RunHistory

runhistory with all runs so far

model: smac.epm.rf_with_instances.RandomForestWithInstances

empirical performance model (right now, we support only RandomForestWithInstances)

acq_optimizer: smac.optimizer.ei_optimization.AcquisitionFunctionMaximizer

Optimizer of acquisition function.

restore_incumbent: Configuration

incumbent to be used from the start. ONLY used to restore states.

rng: np.random.RandomState

Random number generator


Chooser for random configuration – one of * ChooserNoCoolDown(modulus) * ChooserLinearCoolDown(start_modulus, modulus_increment, end_modulus)

predict_x_best: bool

Choose x_best for computing the acquisition function via the model instead of via the observations.

min_samples_model: int

  • Minimum number of samples to build a model

_collect_data_to_train_model() → Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray][source]
_get_evaluated_configs() → List[ConfigSpace.configuration_space.Configuration][source]
_get_x_best(predict: bool, X: numpy.ndarray) → Tuple[float, numpy.ndarray][source]

Get value, configuration, and array representation of the “best” configuration.

The definition of best varies depending on the argument predict. If set to True, this function will return the stats of the best configuration as predicted by the model, otherwise it will return the stats for the best observed configuration.


predict (bool) – Whether to use the predicted or observed best.


  • float

  • np.ndarry

  • Configuration

choose_next(incumbent_value: Optional[float] = None) → Iterator[ConfigSpace.configuration_space.Configuration][source]

Choose next candidate solution with Bayesian optimization. The suggested configurations depend on the argument acq_optimizer to the SMBO class.


incumbent_value (float) – Cost value of incumbent configuration (required for acquisition function); If not given, it will be inferred from runhistory or predicted; if not given and runhistory is empty, it will raise a ValueError.


Return type