ray.tune.ExperimentAnalysis#

class ray.tune.ExperimentAnalysis(experiment_checkpoint_path: str | PathLike, *, storage_filesystem: pyarrow.fs.FileSystem | None = None, trials: List[Trial] | None = None, default_metric: str | None = None, default_mode: str | None = None)[source]#

Analyze results from a Ray Train/Tune experiment.

To use this class, the run must store the history of reported metrics in log files (e.g., result.json and progress.csv). This is the default behavior, unless default loggers are explicitly excluded with the TUNE_DISABLE_AUTO_CALLBACK_LOGGERS=1 environment variable.

Parameters:
  • experiment_checkpoint_path – Path to an experiment_state.json file, or a directory that contains an experiment_state.json file.

  • default_metric – Default metric for comparing results. Can be overwritten with the metric parameter in the respective functions.

  • default_mode – Default mode for comparing results. Has to be one of [min, max]. Can be overwritten with the mode parameter in the respective functions.

  • trials – List of trials that can be accessed via analysis.trials.

PublicAPI (beta): This API is in beta and may change before becoming stable.

Methods

dataframe

Returns a pandas.DataFrame object constructed from the trials.

get_all_configs

Returns all trial hyperparameter configurations.

get_best_checkpoint

Gets best persistent checkpoint path of provided trial.

get_best_config

Retrieve the best config corresponding to the trial.

get_best_trial

Retrieve the best trial object.

get_last_checkpoint

Gets the last checkpoint of the provided trial, i.e., with the highest "training_iteration".

Attributes

best_checkpoint

Get the checkpoint path of the best trial of the experiment

best_config

Get the config of the best trial of the experiment

best_dataframe

Get the full result dataframe of the best trial of the experiment

best_result

Get the last result of the best trial of the experiment

best_result_df

Get the best result of the experiment as a pandas dataframe.

best_trial

Get the best trial of the experiment

experiment_path

Path pointing to the experiment directory on persistent storage.

results

Get the last result of the all trials of the experiment

results_df

Get all the last results as a pandas dataframe.

trial_dataframes

List of all dataframes of the trials.