syne_tune.optimizer.schedulers.searchers.dyhpo package

class syne_tune.optimizer.schedulers.searchers.dyhpo.DynamicHPOSearcher(config_space, metric, points_to_evaluate=None, **kwargs)[source]

Bases: BaseSearcher

Supports model-based decisions in the DyHPO algorithm proposed by Wistuba etal (see DyHPORungSystem).

It is not recommended to create DynamicHPOSearcher searcher objects directly, but rather to create HyperbandScheduler objects with searcher="dyhpo" and type="dyhpo", and passing arguments here in search_options. This will use the appropriate functions from :mod:syne_tune.optimizer.schedulers.searchers.gp_searcher_factory to create components in a consistent way.

This searcher is special, in that it contains a searcher of type GPMultiFidelitySearcher. Also, its model-based scoring is not triggered by get_config(), but rather when the scheduler tries to find a trial which can be promoted. At this point, score_paused_trials_and_new_configs() is called, which scores all paused trials along with new configurations. Depending on who is the best scorer, a paused trial is resumed, or a trial with a new configuration is started. Since all the work is already done in score_paused_trials_and_new_configs(), the implementation of get_config() becomes trivial. See also DyHPORungSystem. Extra points:

  • The number of new configurations scored in score_paused_trials_and_new_configs() is the maximum of num_init_candidates and the number of paused trials scored as well

  • The parameters of the surrogate model are not refit in every call of score_paused_trials_and_new_configs(), but only when in the last recent call, a new configuration was chosen as top scorer. The aim is to do refitting in a similar frequency to MOBSTER, where decisions on whether to resume a trial are not done in a model-based way.

This searcher must be used with HyperbandScheduler and

type="dyhpo". It has the same constructor parameters as

GPMultiFidelitySearcher. Of these, the following are not used, but need to be given valid values: resource_acq, initial_scoring, skip_local_optimization.


Some searchers need to obtain information from the scheduler they are used with, in order to configure themselves. This method has to be called before the searcher can be used.


scheduler (TrialScheduler) – Scheduler the searcher is used with.


Suggest a new configuration.

Note: Query _next_initial_config() for initial configs to return first.


kwargs – Extra information may be passed from scheduler to searcher

Return type:



New configuration. The searcher may return None if a new configuration cannot be suggested. In this case, the tuning will stop. This happens if searchers never suggest the same config more than once, and all configs in the (finite) search space are exhausted.

on_trial_result(trial_id, config, result, update)[source]

Inform searcher about result

The scheduler passes every result. If update == True, the searcher should update its surrogate model (if any), otherwise result is an intermediate result not modelled.

The default implementation calls _update() if update == True. It can be overwritten by searchers which also react to intermediate results.

  • trial_id (str) – See on_trial_result()

  • config (Dict[str, Any]) – See on_trial_result()

  • result (Dict[str, Any]) – See on_trial_result()

  • update (bool) – Should surrogate model be updated?

register_pending(trial_id, config=None, milestone=None)[source]

Signals to searcher that evaluation for trial has started, but not yet finished, which allows model-based searchers to register this evaluation as pending.

  • trial_id (str) – ID of trial to be registered as pending evaluation

  • config (Optional[dict]) – If trial_id has not been registered with the searcher, its configuration must be passed here. Ignored otherwise.

  • milestone (Optional[int]) – For multi-fidelity schedulers, this is the next rung level the evaluation will attend, so that model registers (config, milestone) as pending.

remove_case(trial_id, **kwargs)[source]

Remove data case previously appended by _update()

For searchers which maintain the dataset of all cases (reports) passed to update, this method allows to remove one case from the dataset.

  • trial_id (str) – ID of trial whose data is to be removed

  • kwargs – Extra arguments, optional


Called by scheduler if an evaluation job for a trial failed.

The searcher should react appropriately (e.g., remove pending evaluations for this trial, not suggest the configuration again).


trial_id (str) – ID of trial whose evaluated failed


Removes all pending evaluations for trial trial_id.

This should be called after an evaluation terminates. For various reasons (e.g., termination due to convergence), pending candidates for this evaluation may still be present.


trial_id (str) – ID of trial whose pending evaluations should be cleared


Size of dataset a model is fitted to, or 0 if no model is fitted to data


Dictionary with current model (hyper)parameter values if this is supported; otherwise empty

score_paused_trials_and_new_configs(paused_trials, min_resource, new_trial_id)[source]

This method computes acquisition scores for a number of extended configs \((x, r)\). The acquisition score \(EI(x | r)\) is expected improvement (EI) at resource level \(r\). Here, the incumbent used in EI is the best value attained at level \(r\), or the best value overall if there is no data yet at that level. There are two types of configs being scored:

  • Paused trials: Passed by paused_trials as tuples (trial_id, resource), where resource is the level to be attained by the trial if it was resumed

  • New configurations drawn at random. For these, the score is EI at \(r\) equal to min_resource

We return a dictionary. If a paused trial wins, its trial_id is returned with key “trial_id”. If a new configuration wins, this configuration is returned with key “config”.

Note: As long as the internal searcher still returns configs from points_to_evaluate or drawn at random, this method always returns this config with key “config”. Scoring and considering paused trials is only done afterwards.

  • paused_trials (List[Tuple[str, int, int]]) – See above. Can be empty

  • min_resource (int) – Smallest resource level

  • new_trial_id (str) – ID of new trial to be started in case a new configuration wins

Return type:

Dict[str, Any]


Dictionary, see above


Together with clone_from_state(), this is needed in order to store and re-create the mutable state of the searcher. The state returned here must be pickle-able.

Return type:

Dict[str, Any]


Pickle-able mutable state of searcher


Together with get_state(), this is needed in order to store and re-create the mutable state of the searcher.

Given state as returned by get_state(), this method combines the non-pickle-able part of the immutable state from self with state and returns the corresponding searcher clone. Afterwards, self is not used anymore.


state (Dict[str, Any]) – See above


New searcher object

property debug_log: DebugLogPrinter | None

Some subclasses support writing a debug log, using DebugLogPrinter. See RandomSearcher for an example.


debug_log object`` or None (not supported)