ray.tune.ExperimentAnalysis.get_best_checkpoint#

ExperimentAnalysis.get_best_checkpoint(trial: ray.tune.experiment.trial.Trial, metric: Optional[str] = None, mode: Optional[str] = None, return_path: bool = False) Optional[Union[ray.air.checkpoint.Checkpoint, str]][source]#

Gets best persistent checkpoint path of provided trial.

Any checkpoints with an associated metric value of nan will be filtered out.

Parameters
  • trial – The log directory of a trial, or a trial instance.

  • metric – key of trial info to return, e.g. “mean_accuracy”. “training_iteration” is used by default if no value was passed to self.default_metric.

  • mode – One of [min, max]. Defaults to self.default_mode.

  • return_path – If True, only returns the path (and not the Checkpoint object). If using Ray client, it is not guaranteed that this path is available on the local (client) node. Can also contain a cloud URI.

Returns

Checkpoint object or string if return_path=True.