ray.train.Result
ray.train.Result#
- class ray.train.Result(metrics: Optional[Dict[str, Any]], checkpoint: Optional[Checkpoint], error: Optional[Exception], metrics_dataframe: Optional[pd.DataFrame] = None, best_checkpoints: Optional[List[Tuple[Checkpoint, Dict[str, Any]]]] = None, _local_path: Optional[str] = None, _remote_path: Optional[str] = None, _storage_filesystem: Optional[pyarrow.fs.FileSystem] = None)#
The final result of a ML training run or a Tune trial.
This is the class produced by Trainer.fit(). It contains a checkpoint, which can be used for resuming training and for creating a Predictor object. It also contains a metrics object describing training metrics.
error
is included so that unsuccessful runs and trials can be represented as well.The constructor is a private API.
- checkpoint#
The final checkpoint of the Trainable.
- Type
Optional[Checkpoint]
- error#
The execution error of the Trainable run, if the trial finishes in error.
- Type
Optional[Exception]
- metrics_dataframe#
The full result dataframe of the Trainable. The dataframe is indexed by iterations and contains reported metrics.
- Type
Optional[pd.DataFrame]
- best_checkpoints#
A list of tuples of the best checkpoints saved by the Trainable and their associated metrics. The number of saved checkpoints is determined by the
checkpoint_config
argument ofrun_config
(by default, all checkpoints will be saved).- Type
Optional[List[Tuple[Checkpoint, Dict[str, Any]]]]
- property filesystem: pyarrow.fs.FileSystem#
Return the filesystem that can be used to access the result path.
- Returns
pyarrow.fs.FileSystem implementation.
- classmethod from_path(path: Union[str, os.PathLike]) ray.train.Result [source]#
Restore a Result object from local trial directory.
- Parameters
path – the path to a local trial directory.
- Returns
A
Result
object of that trial.
- get_best_checkpoint(metric: str, mode: str) Optional[Checkpoint] [source]#
Get the best checkpoint from this trial based on a specific metric.
Any checkpoints without an associated metric value will be filtered out.
- Parameters
metric – The key for checkpoints to order on.
mode – One of [“min”, “max”].
- Returns
Checkpoint
object, 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.
- property path: str#
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
s3://bucket/location
,path
will have the valuebucket/location
.