1

I just run my first Ray Tune. I got nice terminal output an all that but now I'm wondering: Which configuration gave me the best score?

I see that there are a ton of results files but is there an easy way to get the best config?

xotix
  • 494
  • 1
  • 13
  • 41

1 Answers1

1

You can use the ExperimentAnalysis object returned by tune.run() to get the best config, like this:

analysis = tune.run(trainable, search_alg=algo, stop={"training_iteration": 20})

best_trial = analysis.best_trial  # Get best trial
best_config = analysis.best_config  # Get best trial's hyperparameters
best_logdir = analysis.best_logdir  # Get best trial's logdir
best_checkpoint = analysis.best_checkpoint  # Get best trial's best checkpoint
best_result = analysis.best_result  # Get best trial's last results
best_result_df = analysis.best_result_df  # Get best result as pandas dataframe

See the documentation: https://docs.ray.io/en/latest/tune/key-concepts.html#analysis

Kai
  • 241
  • 1
  • 3
  • Ah yeah I saw that. Got confused but seems like that analysis object is shared between all runs. – xotix May 10 '21 at 08:32
  • How to do this if I did not save the analysis object? But I have all the result.json files and tfevent logs? – PascalIv Mar 24 '22 at 13:22
  • @xotix how did you resolve it ? – LearnToGrow Jan 03 '23 at 16:03
  • @LearnToGrow Can't remember but apparently using the solution above. I probably didn't use any files. You could ask in one of the Ray Tune's help channels. – xotix Jan 05 '23 at 11:31