optuna.get_all_study_summaries
- optuna.get_all_study_summaries(storage, include_best_trial=True)[source]
获取存储在指定存储中的所有 study 的历史记录。
示例
import optuna def objective(trial): x = trial.suggest_float("x", -10, 10) return (x - 2) ** 2 study = optuna.create_study(study_name="example-study", storage="sqlite:///example.db") study.optimize(objective, n_trials=3) study_summaries = optuna.study.get_all_study_summaries(storage="sqlite:///example.db") assert len(study_summaries) == 1 study_summary = study_summaries[0] assert study_summary.study_name == "example-study"
- 参数:
storage (str | BaseStorage) – 数据库 URL,例如
sqlite:///example.db。有关更多详细信息,请参阅create_study()的文档。include_best_trial (bool) – 是否包含最佳试验。根据存储不同,这可能会增加查询数量并花费更长时间来获取摘要。
- 返回:
以
StudySummary对象形式总结的研究历史列表。- 返回类型: