- class ray.train.Result(metrics: Dict[str, Any] | None, checkpoint: Checkpoint | None, error: Exception | None, path: str, metrics_dataframe: pd.DataFrame | None = None, best_checkpoints: List[Tuple[Checkpoint, Dict[str, Any]]] | None = None, _storage_filesystem: pyarrow.fs.FileSystem | None = None)#
The final result of a ML training run or a Tune trial.
This is the output produced by
ResultGridthat is a collection of
This API is the recommended way to access the outputs such as: - checkpoints (
Result.checkpoint) - the history of reported metrics (
Result.metrics) - errors encountered during a training run (
The constructor is a private API – use
Result.from_pathto create a result object from a directory.
The execution error of the Trainable run, if the trial finishes in error.
Exception | None
Path pointing to the result directory on persistent storage. This can point to a remote storage location (e.g. S3) or to a local location (path on the head node). The path is accessible via the result’s associated
filesystem. For instance, for a result stored in S3 at
pathwill have the value
The full result dataframe of the Trainable. The dataframe is indexed by iterations and contains reported metrics. Note that the dataframe columns are indexed with the flattened keys of reported metrics, so the format of this dataframe may be slightly different than
Result.metrics, which is an unflattened dict of the latest set of reported metrics.
pd.DataFrame | None
A list of tuples of the best checkpoints and their associated metrics. The number of saved checkpoints is determined by
CheckpointConfig(by default, all checkpoints will be saved).
- property filesystem: pyarrow.fs.FileSystem#
Return the filesystem that can be used to access the result path.
- classmethod from_path(path: str | PathLike, storage_filesystem: pyarrow.fs.FileSystem | None = None) Result #
Restore a Result object from local or remote trial directory.
path – A path of a trial directory on local or remote storage (ex: s3://bucket/path or /tmp/ray_results).
storage_filesystem – A custom filesystem to use. If not provided, this will be auto-resolved by pyarrow. If provided, the path is assumed to be prefix-stripped already, and must be a valid path on the filesystem.
Resultobject of that trial.
- get_best_checkpoint(metric: str, mode: str) Checkpoint | None #
Get the best checkpoint from this trial based on a specific metric.
Any checkpoints without an associated metric value will be filtered out.
metric – The key for checkpoints to order on.
mode – One of [“min”, “max”].
Checkpointobject, or None if there is no valid checkpoint associated with the metric.
PublicAPI (alpha): This API is in alpha and may change before becoming stable.