ray.tune.schedulers.MedianStoppingRule#

class ray.tune.schedulers.MedianStoppingRule(time_attr: str = 'time_total_s', metric: str | None = None, mode: str | None = None, grace_period: float = 60.0, min_samples_required: int = 3, min_time_slice: int = 0, hard_stop: bool = True)[source]#

Bases: FIFOScheduler

Implements the median stopping rule as described in the Vizier paper:

https://research.google.com/pubs/pub46180.html

Parameters:
  • time_attr – The training result attr to use for comparing time. Note that you can pass in something non-temporal such as training_iteration as a measure of progress, the only requirement is that the attribute should increase monotonically. Valid values are any key reported in the result dict by your trainable. The auto-filled keys "training_iteration" (the iteration count) and "time_total_s" (wall-clock seconds since the trial started) always work; any additional numeric, monotonic key your trainable reports via tune.report({...}) is also valid (for example "timesteps_total" or a custom progress counter). Passing a key that is not present in the reported result causes the scheduler to skip its decision for that step.

  • metric – The training result objective value attribute. Stopping procedures will use this attribute. If None but a mode was passed, the ray.tune.result.DEFAULT_METRIC will be used per default.

  • mode – One of {min, max}. Determines whether objective is minimizing or maximizing the metric attribute.

  • grace_period – Only stop trials at least this old in time. The mean will only be computed from this time onwards. The units are the same as the attribute named by time_attr.

  • min_samples_required – Minimum number of trials to compute median over.

  • min_time_slice – Each trial runs at least this long before yielding (assuming it isn’t stopped). Note: trials ONLY yield if there are not enough samples to evaluate performance for the current result AND there are other trials waiting to run. The units are the same as the attribute named by time_attr.

  • hard_stop – If False, pauses trials instead of stopping them. When all other trials are complete, paused trials will be resumed and allowed to run FIFO.

Methods

on_trial_result

Callback for early stopping.

restore

Restore trial scheduler from checkpoint.

save

Save trial scheduler to a checkpoint

Attributes

CONTINUE

Status for continuing trial execution

NOOP

PAUSE

Status for pausing trial execution

STOP

Status for stopping trial execution

metric

supports_buffered_results