optuna.multi_objective.study.create_study
- optuna.multi_objective.study.create_study(directions, study_name=None, storage=None, sampler=None, load_if_exists=False)[源代码]
Create a new
MultiObjectiveStudy
.示例
import optuna def objective(trial): # Binh and Korn function. x = trial.suggest_float("x", 0, 5) y = trial.suggest_float("y", 0, 3) v0 = 4 * x ** 2 + 4 * y ** 2 v1 = (x - 5) ** 2 + (y - 5) ** 2 return v0, v1 study = optuna.multi_objective.create_study(["minimize", "minimize"]) study.optimize(objective, n_trials=3)
- 参数
directions (List[str]) – Optimization direction for each objective value. Set
minimize
for minimization andmaximize
for maximization.study_name (Optional[str]) – Study’s name. If this argument is set to None, a unique name is generated automatically.
storage (Optional[Union[str, optuna.storages._base.BaseStorage]]) –
Database URL. If this argument is set to None, in-memory storage is used, and the
Study
will not be persistent.备注
When a database URL is passed, Optuna internally uses SQLAlchemy to handle the database. Please refer to SQLAlchemy’s document for further details. If you want to specify non-default options to SQLAlchemy Engine, you can instantiate
RDBStorage
with your desired options and pass it to thestorage
argument instead of a URL.sampler (Optional[optuna.multi_objective.samplers._base.BaseMultiObjectiveSampler]) – A sampler object that implements background algorithm for value suggestion. If
None
is specified,NSGAIIMultiObjectiveSampler
is used as the default. See alsosamplers
.load_if_exists (bool) – Flag to control the behavior to handle a conflict of study names. In the case where a study named
study_name
already exists in thestorage
, aDuplicatedStudyError
is raised ifload_if_exists
is set toFalse
. Otherwise, the creation of the study is skipped, and the existing one is returned.
- 返回
A
MultiObjectiveStudy
object.- 返回类型
警告
Deprecated in v2.4.0. This feature will be removed in the future. The removal of this feature is currently scheduled for v4.0.0, but this schedule is subject to change. See https://github.com/optuna/optuna/releases/tag/v2.4.0.