optuna.study.load_study
- optuna.study.load_study(*, study_name, storage, sampler=None, pruner=None)[源代码]
加载具有指定名称的现有
Study。示例
import optuna def objective(trial): x = trial.suggest_float("x", 0, 10) return x**2 study = optuna.create_study(storage="sqlite:///example.db", study_name="my_study") study.optimize(objective, n_trials=3) loaded_study = optuna.load_study(study_name="my_study", storage="sqlite:///example.db") assert len(loaded_study.trials) == len(study.trials)
- 参数:
study_name (str | None) – Study’s name. Each study has a unique name as an identifier. If
None, checks whether the storage contains a single study, and if so loads that study.study_nameis required if there are multiple studies in the storage.storage (str | storages.BaseStorage) – 数据库URL,例如
sqlite:///example.db。更多详情请参阅create_study()的文档。sampler ('samplers.BaseSampler' | None) – A sampler object that implements background algorithm for value suggestion. If
Noneis specified,TPESampleris used as the default. See alsosamplers.pruner (pruners.BasePruner | None) – A pruner object that decides early stopping of unpromising trials. If
Noneis specified,MedianPruneris used as the default. See alsopruners.
- 返回:
一个
Study对象。- 返回类型:
参见