syne_tune.optimizer.schedulers.single_fidelity_scheduler module

class syne_tune.optimizer.schedulers.single_fidelity_scheduler.SingleFidelityScheduler(config_space, metrics, do_minimize=True, searcher='random_search', random_seed=None, searcher_kwargs=None)[source]

Bases: TrialScheduler

Scheduler class for both single- and multi-objective methods that optimize using a single fidelity only, e.g., the highest amount of resources.

Parameters:
  • config_space (Dict[str, Any]) – Configuration space for evaluation function

  • metrics (List[str]) – Name of metric to optimize, key in results obtained via on_trial_result.

  • do_minimize (Optional[bool]) – True if we minimize the objective function

  • searcher (Union[str, BaseSearcher, None]) – Searcher for get_config decisions. String values are passed to searcher_factory() along with search_options and extra information. Supported values: SUPPORTED_SEARCHERS_FIFO. Defaults to “random_search” (i.e., random search)

  • random_seed (Optional[int]) – Seed for initializing random number generators.

  • searcher_kwargs (Optional[dict]) – Additional arguments for the searcher.

suggest()[source]

Returns a suggestion for a new trial, or one to be resumed

This method returns suggestion of type TrialSuggestion (unless there is no config left to explore, and None is returned).

If suggestion.spawn_new_trial_id is True, a new trial is to be started with config suggestion.config. Typically, this new trial is started from scratch. But if suggestion.checkpoint_trial_id is given, the trial is to be (warm)started from the checkpoint written for the trial with this ID. The new trial has ID trial_id.

If suggestion.spawn_new_trial_id is False, an existing and currently paused trial is to be resumed, whose ID is suggestion.checkpoint_trial_id. If this trial has a checkpoint, we start from there. In this case, suggestion.config is optional. If not given (default), the config of the resumed trial does not change. Otherwise, its config is overwritten by suggestion.config (see HyperbandScheduler with type="promotion" for an example why this can be useful).

Apart from the HP config, additional fields can be appended to the dict, these are passed to the trial function as well.

Return type:

Optional[TrialSuggestion]

Returns:

Suggestion for a trial to be started or to be resumed, see above. If no suggestion can be made, None is returned

on_trial_error(trial)[source]
on_trial_result(trial, result)[source]

Called on each intermediate result reported by a trial.

At this point, the trial scheduler can make a decision by returning one of SchedulerDecision.CONTINUE, SchedulerDecision.PAUSE, or SchedulerDecision.STOP. This will only be called when the trial is currently running.

Parameters:
  • trial (Trial) – Trial for which results are reported

  • result (Dict[str, Any]) – Result dictionary

Return type:

str

Returns:

Decision what to do with the trial

on_trial_complete(trial, result)[source]

Notification for the completion of trial.

Note that on_trial_result() is called with the same result before. However, if the scheduler only uses one final report from each trial, it may ignore on_trial_result() and just use result here.

Parameters:
  • trial (Trial) – Trial which is completing

  • result (Dict[str, Any]) – Result dictionary

metadata()[source]
Return type:

Dict[str, Any]

Returns:

Metadata for the scheduler

metric_names()[source]
Return type:

List[str]

metric_mode()[source]
Return type:

str