smac.facade.experimental.hydra_facade module

class smac.facade.experimental.hydra_facade.Hydra(scenario: Type[smac.scenario.scenario.Scenario], n_iterations: int, val_set: str = 'train', incs_per_round: int = 1, n_optimizers: int = 1, rng: Optional[Union[int, numpy.random.mtrand.RandomState]] = None, run_id: int = 1, tae: Type[smac.tae.base.BaseRunner] = <class 'smac.tae.execute_ta_run_old.ExecuteTARunOld'>, tae_kwargs: Optional[dict] = None, **kwargs)[source]

Bases: object

Facade to use Hydra default mode

logger
stats

loggs information about used resources

Type

Stats

solver

handles the actual algorithm calls

Type

SMBO

rh

List with information about previous runs

Type

RunHistory

portfolio

List of all incumbents

Type

list

Constructor

Parameters
  • scenario (Scenario) – Scenario object

  • n_iterations (int,) – number of Hydra iterations

  • val_set (str) – Set to validate incumbent(s) on. [train, valX]. train => whole training set, valX => train_set * 100/X where X in (0, 100)

  • incs_per_round (int) – Number of incumbents to keep per round

  • n_optimizers (int) – Number of optimizers to run in parallel per round

  • rng (int/np.random.RandomState) – The randomState/seed to pass to each smac run

  • run_id (int) – run_id for this hydra run

  • tae (BaseRunner) – Target Algorithm Runner (supports old and aclib format as well as AbstractTAFunc)

  • tae_kwargs (Optional[dict]) – arguments passed to constructor of ‘~tae’

_get_validation_set(val_set: str, delete: bool = True) → List[str][source]

Create small validation set for hydra to determine incumbent performance

Parameters
  • val_set (str) – Set to validate incumbent(s) on. [train, valX]. train => whole training set, valX => train_set * 100/X where X in (0, 100)

  • delete (bool) – Flag to delete all validation instances from the training set

Returns

val – List of instance-ids to validate on

Return type

typing.List[str]

_update_portfolio(incs: numpy.ndarray, config_cost_per_inst: Dict) → float[source]

Validates all configurations (in incs) and determines which ones to add to the portfolio

Parameters

incs (np.ndarray) – List of Configurations

Returns

cur_cost – The current cost of the portfolio

Return type

typing.Union[np.float, float]

optimize() → List[ConfigSpace.configuration_space.Configuration][source]

Optimizes the algorithm provided in scenario (given in constructor)

Returns

portfolio – Portfolio of found configurations

Return type

typing.List[Configuration]