syne_tune.optimizer.schedulers.median_stopping_rule module
- class syne_tune.optimizer.schedulers.median_stopping_rule.MedianStoppingRule(scheduler, resource_attr, running_average=True, metric=None, grace_time=1, grace_population=5, rank_cutoff=0.5, random_seed=None, do_minimize=True)[source]
Bases:
TrialScheduler
Applies median stopping rule in top of an existing scheduler.
If result at time-step ranks less than the cutoff of other results observed at this time-step, the trial is interrupted and otherwise, the wrapped scheduler is called to make the stopping decision.
Suggest decisions are left to the wrapped scheduler.
The mode of the wrapped scheduler is used.
Reference:
Google Vizier: A Service for Black-Box Optimization.Golovin et al. 2017.Proceedings of the 23rd ACM SIGKDD International Conference on KnowledgeDiscovery and Data Mining, August 2017Pages 1487–1495- Parameters:
scheduler (
TrialScheduler
) – Scheduler to be called for trial suggestion or when median-stopping-rule decision is to continue.resource_attr (
str
) – Key in the reported dictionary that accounts for the resource (e.g. epoch).running_average (
bool
) – IfTrue
, then uses the running average of observation instead of raw observations. Defaults toTrue
metric (
Optional
[str
]) – Metric to be considered, defaults toscheduler.metric
grace_time (
Optional
[int
]) – Median stopping rule is only applied for results whoseresource_attr
exceeds this amount. Defaults to 1grace_population (
int
) – Median stopping rule when at leastgrace_population
have been observed at a resource level. Defaults to 5rank_cutoff (
float
) – Results whose quantiles are below this level are discarded. Defaults to 0.5 (median)random_seed (
Optional
[int
]) – Seed used to initialize the random number generators.do_minimize (
Optional
[bool
]) – True if we minimize the objective function
- suggest()[source]
Returns a suggestion for a new trial, or one to be resumed
This method returns
suggestion
of typeTrialSuggestion
(unless there is no config left to explore, and None is returned).If
suggestion.spawn_new_trial_id
isTrue
, a new trial is to be started with configsuggestion.config
. Typically, this new trial is started from scratch. But ifsuggestion.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 IDtrial_id
.If
suggestion.spawn_new_trial_id
isFalse
, an existing and currently paused trial is to be resumed, whose ID issuggestion.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 bysuggestion.config
(seeHyperbandScheduler
withtype="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_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
, orSchedulerDecision.STOP
. This will only be called when the trial is currently running.- Parameters:
trial (
Trial
) – Trial for which results are reportedresult (
Dict
) – Result dictionary
- Return type:
str
- Returns:
Decision what to do with the trial