Result#
- class ray.train.Result(metrics: Dict[str, Any] | None, checkpoint: Checkpoint | None, error: TrainingFailedError | None, path: str, metrics_dataframe: pandas.DataFrame | None = None, best_checkpoints: List[Tuple[Checkpoint, Dict[str, Any]]] | None = None, _storage_filesystem: FileSystem | None = None, return_value: Any | None = None)#
Bases:
ResultThe output of
trainer.fit().Ray Train keeps the metrics passed to
ray.train.report()only when that call also saves a checkpoint. If the training function reports metrics without a checkpoint after its last checkpoint,latest_checkpoint_metricsandmetrics_dataframedon’t include them. To record every reported metric, log it to an experiment tracking tool or read it inray.train.UserCallback.after_report().- latest_checkpoint#
The latest checkpoint saved by the training function with
ray.train.report().Noneif no checkpoint was saved.
- metrics#
Same as
latest_checkpoint_metrics.
- checkpoint#
Same as
latest_checkpoint.- Type:
ray.train.Checkpoint | None
- return_value#
The value returned by the user-defined training function on the rank 0 worker, or
Noneif no value was returned or if training did not complete successfully. The return value must be serializable.- Type:
Any | None
- metrics_dataframe#
A DataFrame of metrics from all checkpoints saved during the run. Each row corresponds to a checkpoint.
- best_checkpoints#
A list of
(checkpoint, metrics)tuples for the best checkpoints saved during the run. The checkpoints retained are determined byCheckpointConfig(by default, all checkpoints are kept).- Type:
List[Tuple[ray.train.Checkpoint, Dict[str, Any]]] | None
- path#
Path pointing to the run output directory on persistent storage. This can point to a remote storage location (e.g. S3) or to a local location on the head node.
- error#
The execution error of the training run, if the run finished in error. This is a
TrainingFailedErrorwrapping the original exception.- Type:
- property config: Dict[str, Any] | None#
Warning
DEPRECATED: This API is deprecated and may be removed in future Ray releases.
- classmethod from_path(path: str | PathLike, storage_filesystem: FileSystem | None = None) Result[source]#
Restore a training result from a previously saved training run path.
- Parameters:
storage_filesystem (FileSystem | None) – Optional filesystem to use for accessing the path
- Returns:
Result object with restored checkpoints and metrics
- Return type:
- get_best_checkpoint(metric: str, mode: str) Checkpoint | None[source]#
PublicAPI (alpha): This API is in alpha and may change before becoming stable.
- property latest_checkpoint_metrics: Dict[str, Any] | None#
The metrics attached to the latest checkpoint.
Ray Train keeps only the metrics reported together with a checkpoint, so if the last
ray.train.report()call had no checkpoint, these are the metrics of an earlier call.Noneif no checkpoint was saved.Equivalent to
Result.metrics.