ray.tune.grid_search#
- ray.tune.grid_search(values: Iterable) Dict[str, Iterable] [source]#
Specify a grid of values to search over.
Values specified in a grid search are guaranteed to be sampled.
If multiple grid search variables are defined, they are combined with the combinatorial product. This means every possible combination of values will be sampled.
Example
>>> from ray import tune >>> param_space={ ... "x": tune.grid_search([10, 20]), ... "y": tune.grid_search(["a", "b", "c"]) ... }
This will create a grid of 6 samples:
{"x": 10, "y": "a"}
,{"x": 10, "y": "b"}
, etc.When specifying
num_samples
in theTuneConfig
, this will specify the number of random samples per grid search combination.For instance, in the example above, if
num_samples=4
, a total of 24 trials will be started - 4 trials for each of the 6 grid search combinations.- Parameters:
values – An iterable whose parameters will be used for creating a trial grid.
PublicAPI (beta): This API is in beta and may change before becoming stable.