smac.facade.experimental.psmac_facade module

class smac.facade.experimental.psmac_facade.PSMAC(scenario: Type[smac.scenario.scenario.Scenario], 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, shared_model: bool = True, validate: bool = True, n_optimizers: int = 2, val_set: Optional[List[str]] = None, n_incs: int = 1, **kwargs)

Bases: object

Facade to use PSMAC

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

_get_mean_costs(incs: List[ConfigSpace.configuration_space.Configuration], new_rh: smac.runhistory.runhistory.RunHistory)

Compute mean cost per instance

Parameters
  • incs (typing.List[Configuration]) – incumbents determined by all parallel SMAC runs

  • new_rh (RunHistory) – runhistory to determine mean performance

Returns

  • List[float] means

  • Dict(Config -> Dict(inst_id(str) -> float))

get_best_incumbents_ids(incs: List[ConfigSpace.configuration_space.Configuration])

Determines the IDs and costs of the best configurations

Parameters

incs (typing.List[Configuration]) – incumbents determined by all parallel SMAC runs

Returns

  • Dict(Config -> Dict(inst_id (str) -> cost (float))) (if real validation runs are performed)

  • List(ints) (indices of best configurations if validation runs are performed)

  • Dict(Config -> Dict(inst_id (str) -> cost (float))) (if performance is estimated)

  • List(ints) (indices of best configurations if performance is estimated)

optimize()

Optimizes the algorithm provided in scenario (given in constructor)

Returns

  • incumbent(s) (Configuration / List[Configuration] / ndarray[Configuration]) – Incumbent / Portfolio of incumbents

  • pid(s) (int / ndarray[ints]) – Process ID(s) from which the configuration stems

validate_incs(incs: numpy.ndarray)

Validation

smac.facade.experimental.psmac_facade.optimize(scenario: Type[smac.scenario.scenario.Scenario], tae: Type[smac.tae.base.BaseRunner], tae_kwargs: Dict, rng: Union[numpy.random.mtrand.RandomState, int], output_dir: str, **kwargs) ConfigSpace.configuration_space.Configuration

Unbound method to be called in a subprocess

Parameters
  • scenario (Scenario) – smac.Scenario to initialize SMAC

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

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

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

  • output_dir (str) – The directory in which each smac run should write it’s results

Returns

incumbent – The incumbent configuration of this run

Return type

Configuration