ray.tune.search.Repeater#

class ray.tune.search.Repeater(searcher: Searcher, repeat: int = 1, set_index: bool = True)[source]#

Bases: 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()

Methods

add_evaluated_point

Pass results from a point that has been evaluated separately.

add_evaluated_trials

Pass results from trials that have been evaluated separately.

on_trial_complete

Stores the score for and keeps track of a completed trial.

on_trial_result

Optional notification for result during training.

restore_from_dir

Restores the state of a searcher from a given checkpoint_dir.

save_to_dir

Automatically saves the given searcher to the checkpoint_dir.

set_max_concurrency

Set max concurrent trials this searcher can run.

Attributes

CKPT_FILE_TMPL

FINISHED

metric

The training result objective value attribute.

mode

Specifies if minimizing or maximizing the metric.