Skip to content

Commit

Permalink
Replace option with argument
Browse files Browse the repository at this point in the history
Co-authored-by: Naoto Mizuno <[email protected]>
  • Loading branch information
nabenabe0928 and not522 committed May 15, 2024
1 parent 41f5040 commit c4de828
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions optuna/_experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
"""


def warn_experimental_option(option_name: str) -> None:
def warn_experimental_argument(option_name: str) -> None:
warnings.warn(
f"``{option_name}`` option is an experimental feature."
f"Argument ``{option_name}`` is an experimental feature."
" The interface can change in the future.",
ExperimentalWarning,
)
Expand Down
4 changes: 2 additions & 2 deletions optuna/importance/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import List
from typing import Optional

from optuna._experimental import warn_experimental_option
from optuna._experimental import warn_experimental_argument
from optuna.importance._base import BaseImportanceEvaluator
from optuna.importance._fanova import FanovaImportanceEvaluator
from optuna.importance._mean_decrease_impurity import MeanDecreaseImpurityImportanceEvaluator
Expand Down Expand Up @@ -118,5 +118,5 @@ def get_param_importances(
else:
return dict((param, value / s) for (param, value) in res.items())
else:
warn_experimental_option("normalize")
warn_experimental_argument("normalize")
return res
14 changes: 7 additions & 7 deletions optuna/samplers/_cmaes.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import optuna
from optuna import logging
from optuna._experimental import warn_experimental_option
from optuna._experimental import warn_experimental_argument
from optuna._imports import _LazyImport
from optuna._transform import _SearchSpaceTransform
from optuna.distributions import BaseDistribution
Expand Down Expand Up @@ -281,22 +281,22 @@ def __init__(
self._source_trials = source_trials

if self._restart_strategy:
warn_experimental_option("restart_strategy")
warn_experimental_argument("restart_strategy")

if self._consider_pruned_trials:
warn_experimental_option("consider_pruned_trials")
warn_experimental_argument("consider_pruned_trials")

if self._use_separable_cma:
warn_experimental_option("use_separable_cma")
warn_experimental_argument("use_separable_cma")

if self._source_trials is not None:
warn_experimental_option("source_trials")
warn_experimental_argument("source_trials")

if self._with_margin:
warn_experimental_option("with_margin")
warn_experimental_argument("with_margin")

if self._lr_adapt:
warn_experimental_option("lr_adapt")
warn_experimental_argument("lr_adapt")

if source_trials is not None and (x0 is not None or sigma0 is not None):
raise ValueError(
Expand Down
12 changes: 6 additions & 6 deletions optuna/samplers/_tpe/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import numpy as np

from optuna._experimental import warn_experimental_option
from optuna._experimental import warn_experimental_argument
from optuna._hypervolume import WFG
from optuna._hypervolume.hssp import _solve_hssp
from optuna.distributions import BaseDistribution
Expand Down Expand Up @@ -322,24 +322,24 @@ def __init__(
self._parzen_estimator_cls = _ParzenEstimator

if multivariate:
warn_experimental_option("multivariate")
warn_experimental_argument("multivariate")

if group:
if not multivariate:
raise ValueError(
"``group`` option can only be enabled when ``multivariate`` is enabled."
)
warn_experimental_option("group")
warn_experimental_argument("group")
self._group_decomposed_search_space = _GroupDecomposedSearchSpace(True)

if constant_liar:
warn_experimental_option("constant_liar")
warn_experimental_argument("constant_liar")

if constraints_func is not None:
warn_experimental_option("constraints_func")
warn_experimental_argument("constraints_func")

if categorical_distance_func is not None:
warn_experimental_option("categorical_distance_func")
warn_experimental_argument("categorical_distance_func")

def reseed_rng(self) -> None:
self._rng.rng.seed()
Expand Down
10 changes: 5 additions & 5 deletions optuna/samplers/nsgaii/_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing import TYPE_CHECKING

import optuna
from optuna._experimental import warn_experimental_option
from optuna._experimental import warn_experimental_argument
from optuna.distributions import BaseDistribution
from optuna.samplers._base import BaseSampler
from optuna.samplers._lazy_random_state import LazyRandomState
Expand Down Expand Up @@ -160,15 +160,15 @@ def __init__(
raise ValueError("`population_size` must be greater than or equal to 2.")

if constraints_func is not None:
warn_experimental_option("constraints_func")
warn_experimental_argument("constraints_func")
if after_trial_strategy is not None:
warn_experimental_option("after_trial_strategy")
warn_experimental_argument("after_trial_strategy")

if child_generation_strategy is not None:
warn_experimental_option("child_generation_strategy")
warn_experimental_argument("child_generation_strategy")

if elite_population_selection_strategy is not None:
warn_experimental_option("elite_population_selection_strategy")
warn_experimental_argument("elite_population_selection_strategy")

if crossover is None:
crossover = UniformCrossover(swapping_prob)
Expand Down
4 changes: 2 additions & 2 deletions optuna/visualization/_pareto_front.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import warnings

import optuna
from optuna._experimental import warn_experimental_option
from optuna._experimental import warn_experimental_argument
from optuna.study import Study
from optuna.study._multi_objective import _get_pareto_front_trials_by_trials
from optuna.trial import FrozenTrial
Expand Down Expand Up @@ -252,7 +252,7 @@ def _get_pareto_front_info(
)

if constraints_func is not None:
warn_experimental_option("constraints_func")
warn_experimental_argument("constraints_func")
feasible_trials = []
infeasible_trials = []
for trial in study.get_trials(deepcopy=False, states=(TrialState.COMPLETE,)):
Expand Down

0 comments on commit c4de828

Please sign in to comment.