smac.facade.hyperparameter_optimization_facade

Classes

HyperparameterOptimizationFacade(scenario, ...)

Interfaces

class smac.facade.hyperparameter_optimization_facade.HyperparameterOptimizationFacade(scenario, target_function, *, model=None, acquisition_function=None, acquisition_maximizer=None, initial_design=None, random_design=None, intensifier=None, multi_objective_algorithm=None, runhistory_encoder=None, config_selector=None, logging_level=None, callbacks=None, overwrite=False, dask_client=None)[source]

Bases: AbstractFacade

static get_acquisition_function(scenario, *, xi=0.0)[source]

Returns an Expected Improvement acquisition function.

Parameters:
  • scenario (Scenario)

  • xi (float, defaults to 0.0) – Controls the balance between exploration and exploitation of the acquisition function.

Return type:

EI

static get_acquisition_maximizer(scenario, *, challengers=10000, local_search_iterations=10)[source]

Returns local and sorted random search as acquisition maximizer.

Warning

If you experience RAM issues, try to reduce the number of challengers.

Parameters:
  • challengers (int, defaults to 10000) – Number of challengers.

  • local_search_iterations (int, defaults to 10) – Number of local search iterations.

Return type:

LocalAndSortedRandomSearch

static get_initial_design(scenario, *, n_configs=None, n_configs_per_hyperparamter=10, max_ratio=0.25, additional_configs=None)[source]

Returns a Sobol design instance.

Parameters:
  • scenario (Scenario)

  • n_configs (int | None, defaults to None) – Number of initial configurations (disables the arguments n_configs_per_hyperparameter).

  • n_configs_per_hyperparameter (int, defaults to 10) – Number of initial configurations per hyperparameter. For example, if my configuration space covers five hyperparameters and n_configs_per_hyperparameter is set to 10, then 50 initial configurations will be samples.

  • max_ratio (float, defaults to 0.25) – Use at most scenario.n_trials * max_ratio number of configurations in the initial design. Additional configurations are not affected by this parameter.

  • additional_configs (list[Configuration], defaults to []) – Adds additional configurations to the initial design.

Return type:

SobolInitialDesign

static get_intensifier(scenario, *, max_config_calls=3, max_incumbents=10)[source]

Returns Intensifier as intensifier. Uses the default configuration for race_against.

Parameters:
  • scenario (Scenario)

  • max_config_calls (int, defaults to 3) – Maximum number of configuration evaluations. Basically, how many instance-seed keys should be max evaluated for a configuration.

  • max_incumbents (int, defaults to 10) – How many incumbents to keep track of in the case of multi-objective.

Return type:

Intensifier

static get_model(scenario, *, n_trees=10, ratio_features=1.0, min_samples_split=2, min_samples_leaf=1, max_depth=1048576, bootstrapping=True)[source]

Returns a random forest as surrogate model.

Parameters:
  • n_trees (int, defaults to 10) – The number of trees in the random forest.

  • ratio_features (float, defaults to 5.0 / 6.0) – The ratio of features that are considered for splitting.

  • min_samples_split (int, defaults to 3) – The minimum number of data points to perform a split.

  • min_samples_leaf (int, defaults to 3) – The minimum number of data points in a leaf.

  • max_depth (int, defaults to 20) – The maximum depth of a single tree.

  • bootstrapping (bool, defaults to True) – Enables bootstrapping.

Return type:

RandomForest

static get_multi_objective_algorithm(scenario, *, objective_weights=None)[source]

Returns the mean aggregation strategy for the multi-objective algorithm.

Parameters:
  • scenario (Scenario)

  • objective_weights (list[float] | None, defaults to None) – Weights for averaging the objectives in a weighted manner. Must be of the same length as the number of objectives.

Return type:

MeanAggregationStrategy

static get_random_design(scenario, *, probability=0.2)[source]

Returns ProbabilityRandomDesign for interleaving configurations.

Parameters:

probability (float, defaults to 0.2) – Probability that a configuration will be drawn at random.

Return type:

ProbabilityRandomDesign

static get_runhistory_encoder(scenario)[source]

Returns a log scaled runhistory encoder. That means that costs are log scaled before training the surrogate model.

Return type:

RunHistoryLogScaledEncoder