使用 Ray Tune 进行超参数搜索后的最佳配置
Best Config after Hyperparameter Search with Ray Tune
我刚刚 运行 我的第一个 Ray Tune。我得到了很好的终端输出,但现在我想知道:哪种配置给我最好的分数?
我看到有大量的结果文件,但是有没有简单的方法来获得最佳配置?
您可以使用 tune.run()
返回的 ExperimentAnalysis
对象来获得最佳配置,如下所示:
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
查看文档:https://docs.ray.io/en/latest/tune/key-concepts.html#analysis
我刚刚 运行 我的第一个 Ray Tune。我得到了很好的终端输出,但现在我想知道:哪种配置给我最好的分数?
我看到有大量的结果文件,但是有没有简单的方法来获得最佳配置?
您可以使用 tune.run()
返回的 ExperimentAnalysis
对象来获得最佳配置,如下所示:
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
查看文档:https://docs.ray.io/en/latest/tune/key-concepts.html#analysis