ray.tune.stopper.CombinedStopper#

class ray.tune.stopper.CombinedStopper(*stoppers: ray.tune.stopper.stopper.Stopper)[source]#

Bases: ray.tune.stopper.stopper.Stopper

Combine several stoppers via β€˜OR’.

Parameters

*stoppers – Stoppers to be combined.

Examples

>>> import numpy as np
>>> from ray import air, tune
>>> from ray.air import session
>>> from ray.tune.stopper import (
...     CombinedStopper,
...     MaximumIterationStopper,
...     TrialPlateauStopper,
... )
>>>
>>> stopper = CombinedStopper(
...     MaximumIterationStopper(max_iter=10),
...     TrialPlateauStopper(metric="my_metric"),
... )
>>> def train_fn(config):
...     for i in range(15):
...         session.report({"my_metric": np.random.normal(0, 1 - i / 15)})
...
>>> tuner = tune.Tuner(
...     train_fn,
...     run_config=air.RunConfig(stop=stopper),
... )
>>> print("[ignore]"); result_grid = tuner.fit()  
[ignore]...

PublicAPI: This API is stable across Ray releases.

stop_all()[source]#

Returns true if the experiment should be terminated.