optuna.study.get_all_study_names
- optuna.study.get_all_study_names(storage)[source]
获取存储在指定存储中的所有研究名称。
示例
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_names = optuna.study.get_all_study_names(storage="sqlite:///example.db") assert len(study_names) == 1 assert study_names[0] == "example-study"
- 参数:
storage (str | BaseStorage) – 数据库 URL,例如
sqlite:///example.db
。有关更多详细信息,请参阅create_study()
的文档。- 返回:
存储中所有研究名称的列表。
- 返回类型: