ray.tune.search.Repeater
ray.tune.search.Repeater#
- class ray.tune.search.Repeater(searcher: ray.tune.search.searcher.Searcher, repeat: int = 1, set_index: bool = True)[source]#
Bases:
ray.tune.search.searcher.Searcher
A wrapper algorithm for repeating trials of same parameters.
Set tune.TuneConfig(num_samples=…) to be a multiple of
repeat
. For example, set num_samples=15 if you intend to obtain 3 search algorithm suggestions and repeat each suggestion 5 times. Any leftover trials (num_samples mod repeat) will be ignored.It is recommended that you do not run an early-stopping TrialScheduler simultaneously.
- Parameters
searcher – Searcher object that the Repeater will optimize. Note that the Searcher will only see 1 trial among multiple repeated trials. The result/metric passed to the Searcher upon trial completion will be averaged among all repeats.
repeat – Number of times to generate a trial with a repeated configuration. Defaults to 1.
set_index – Sets a tune.search.repeater.TRIAL_INDEX in Trainable/Function config which corresponds to the index of the repeated trial. This can be used for seeds. Defaults to True.
Example:
from ray.tune.search import Repeater search_alg = BayesOptSearch(...) re_search_alg = Repeater(search_alg, repeat=10) # Repeat 2 samples 10 times each. tuner = tune.Tuner( trainable, tune_config=tune.TuneConfig( search_alg=re_search_alg, num_samples=20, ), ) tuner.fit()
PublicAPI: This API is stable across Ray releases.
Methods
add_evaluated_point
(parameters, value[, ...])Pass results from a point that has been evaluated separately.
add_evaluated_trials
(trials_or_analysis, metric)Pass results from trials that have been evaluated separately.
on_trial_complete
(trial_id[, result])Stores the score for and keeps track of a completed trial.
on_trial_result
(trial_id, result)Optional notification for result during training.
restore_from_dir
(checkpoint_dir)Restores the state of a searcher from a given checkpoint_dir.
save_to_dir
(checkpoint_dir[, session_str])Automatically saves the given searcher to the checkpoint_dir.
set_max_concurrency
(max_concurrent)Set max concurrent trials this searcher can run.
Attributes
The training result objective value attribute.
Specifies if minimizing or maximizing the metric.