ray.tune.Experiment
ray.tune.Experiment#
- class ray.tune.Experiment(name: str, run: Union[str, Callable, Type], *, stop: Optional[Union[Mapping, ray.tune.stopper.stopper.Stopper, Callable[[str, Mapping], bool]]] = None, time_budget_s: Optional[Union[int, float, datetime.timedelta]] = None, config: Optional[Dict[str, Any]] = None, resources_per_trial: Union[None, Mapping[str, Union[float, int, Mapping]], PlacementGroupFactory] = None, num_samples: int = 1, storage_path: Optional[str] = None, storage_filesystem: Optional[pyarrow.fs.FileSystem] = None, _experiment_checkpoint_dir: Optional[str] = None, sync_config: Optional[Union[ray.train.SyncConfig, dict]] = None, checkpoint_config: Optional[Union[ray.train.CheckpointConfig, dict]] = None, trial_name_creator: Optional[Callable[[Trial], str]] = None, trial_dirname_creator: Optional[Callable[[Trial], str]] = None, log_to_file: bool = False, export_formats: Optional[Sequence] = None, max_failures: int = 0, restore: Optional[str] = None, local_dir: Optional[str] = None)[source]#
Bases:
objectTracks experiment specifications.
Implicitly registers the Trainable if needed. The args here take the same meaning as the arguments defined
tune.py:run.experiment_spec = Experiment( "my_experiment_name", my_func, stop={"mean_accuracy": 100}, config={ "alpha": tune.grid_search([0.2, 0.4, 0.6]), "beta": tune.grid_search([1, 2]), }, resources_per_trial={ "cpu": 1, "gpu": 0 }, num_samples=10, local_dir="~/ray_results", checkpoint_freq=10, max_failures=2)
- Parameters
TODO (xwjiang) – Add the whole list.
_experiment_checkpoint_dir – Internal use only. If present, use this as the root directory for experiment checkpoint. If not present, the directory path will be deduced from trainable name instead.
DeveloperAPI: This API may change across minor Ray releases.
Methods
from_json(name, spec)Generates an Experiment object from JSON.
get_experiment_checkpoint_dir(run_obj[, ...])Get experiment checkpoint dir without setting up an experiment.
get_trainable_name(run_object)Get Trainable name.
register_if_needed(run_object)Registers Trainable or Function at runtime.
Attributes
Returns the spec dict with only the public-facing keys.
Returns a string representing the trainable identifier.