Ray 2.7.0

  • Welcome to Ray!

Ray

  • Overview
  • Getting Started
  • Installation
  • Use Cases
  • Example Gallery
  • Ecosystem
  • Ray Core
  • Ray Data
  • Ray Train
  • Ray Tune
    • Getting Started
    • Key Concepts
    • User Guides
    • Ray Tune Examples
    • Ray Tune FAQ
    • Ray Tune API
      • Tune Execution (tune.Tuner)
      • Tune Experiment Results (tune.ResultGrid)
      • Training in Tune (tune.Trainable, session.report)
      • Tune Search Space API
        • ray.tune.uniform
        • ray.tune.quniform
        • ray.tune.loguniform
        • ray.tune.qloguniform
        • ray.tune.randn
        • ray.tune.qrandn
        • ray.tune.randint
        • ray.tune.qrandint
        • ray.tune.lograndint
        • ray.tune.qlograndint
        • ray.tune.choice
        • ray.tune.grid_search
        • ray.tune.sample_from
      • Tune Search Algorithms (tune.search)
      • Tune Trial Schedulers (tune.schedulers)
      • Tune Stopping Mechanisms (tune.stopper)
      • Tune Console Output (Reporters)
      • Syncing in Tune (train.SyncConfig)
      • Tune Loggers (tune.logger)
      • Tune Callbacks (tune.Callback)
      • Environment variables used by Ray Tune
      • Tune Scikit-Learn API (tune.sklearn)
      • External library integrations for Ray Tune
      • Tune Internals
      • Tune Client API
      • Tune CLI (Experimental)
  • Ray Serve
  • Ray RLlib
  • More Libraries
  • Ray Clusters
  • Monitoring and Debugging
  • References
  • Developer Guides
  • Security
Theme by the Executable Book Project
  • repository
  • open issue
  • suggest edit
  • .rst

ray.tune.grid_search

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 the TuneConfig, 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.

previous

ray.tune.choice

next

ray.tune.sample_from

Thanks for the feedback!
Was this helpful?
Yes
No
Feedback
Submit

By The Ray Team
© Copyright 2023, The Ray Team.