optuna.study.get_all_study_summaries
- optuna.study.get_all_study_summaries(storage, include_best_trial=True)[源码]
获取存储在指定存储中的所有研究历史。
示例
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
对象。- 返回类型: