ray.tune.ExperimentAnalysis
ray.tune.ExperimentAnalysis#
- class ray.tune.ExperimentAnalysis(experiment_checkpoint_path: str, trials: Optional[List[ray.tune.experiment.trial.Trial]] = None, default_metric: Optional[str] = None, default_mode: Optional[str] = None, remote_storage_path: Optional[str] = None, sync_config: Optional[ray.tune.syncer.SyncConfig] = None)[source]#
Bases:
objectAnalyze results from a Tune experiment.
To use this class, the experiment must be executed with the JsonLogger.
- Parameters
experiment_checkpoint_path – Path to a json file or directory representing an experiment state, or a directory containing multiple experiment states (a run’s
local_dir). Corresponds to Experiment.local_dir/Experiment.name/ experiment_state.jsontrials – List of trials that can be accessed via
analysis.trials.default_metric – Default metric for comparing results. Can be overwritten with the
metricparameter in the respective functions.default_mode – Default mode for comparing results. Has to be one of [min, max]. Can be overwritten with the
modeparameter in the respective functions.
Example
>>> from ray import tune >>> tune.run( ... my_trainable, name="my_exp", local_dir="~/tune_results") >>> analysis = ExperimentAnalysis( ... experiment_checkpoint_path="~/tune_results/my_exp/state.json")
PublicAPI (beta): This API is in beta and may change before becoming stable.
Methods
dataframe([metric, mode])Returns a pandas.DataFrame object constructed from the trials.
Fetches trial dataframes from files.
get_all_configs([prefix])Returns a list of all configurations.
get_best_checkpoint(trial[, metric, mode, ...])Gets best persistent checkpoint path of provided trial.
get_best_config([metric, mode, scope])Retrieve the best config corresponding to the trial.
get_best_logdir([metric, mode, scope])Retrieve the logdir corresponding to the best trial.
get_best_trial([metric, mode, scope, ...])Retrieve the best trial object.
get_last_checkpoint([trial, metric, mode])Gets the last persistent checkpoint path of the provided trial, i.e., with the highest "training_iteration".
get_trial_checkpoints_paths(trial[, metric])Gets paths and metrics of all persistent checkpoints of a trial.
Returns a dictionary of the TuneController data.
set_filetype([file_type])Overrides the existing file type.
stats()Returns a dictionary of the statistics of the experiment.
Attributes
Get the checkpoint path of the best trial of the experiment
Get the config of the best trial of the experiment
Get the full result dataframe of the best trial of the experiment
Get the logdir of the best trial of the experiment
Get the last result of the best trial of the experiment
Get the best result of the experiment as a pandas dataframe.
Get the best trial of the experiment
Path pointing to the experiment directory on persistent storage.
Get the last result of the all trials of the experiment
Get all the last results as a pandas dataframe.
List of all dataframes of the trials.