Skip to content

Commit b5210c0

Browse files
authored
Merge pull request #70 from kAIto47802/doc-update-example-to-autosampler
Update example in `index.rst` to `AutoSampler`
2 parents 0454dda + f305934 commit b5210c0

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

docs/source/index.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ Install the `optunahub`_ package.
1515
1616
pip install optunahub
1717
18-
Load the package you want from the OptunaHub registry. In the next example code, you will load the ``SimulatedAnnealingSampler`` from the `samplers/simulated_annealing <https://hub.optuna.org/samplers/simulated_annealing/>`__ package.
18+
Load the package you want from the OptunaHub registry. In the next example code, you will load the ``AutoSampler`` from the `samplers/auto_sampler <https://hub.optuna.org/samplers/auto_sampler/>`__ package.
19+
The details for ``AutoSampler`` can be found in `this article <https://medium.com/optuna/autosampler-automatic-selection-of-optimization-algorithms-in-optuna-1443875fd8f9>`__.
1920

2021
.. code-block:: python
2122
@@ -24,15 +25,16 @@ Load the package you want from the OptunaHub registry. In the next example code,
2425
2526
2627
def objective(trial: optuna.Trial) -> float:
27-
x = trial.suggest_float("x", 0, 1)
28+
x = trial.suggest_float("x", -5, 5)
29+
y = trial.suggest_float("y", -5, 5)
2830
29-
return x
31+
return x**2 + y**2
3032
3133
32-
mod = optunahub.load_module("samplers/simulated_annealing")
34+
mod = optunahub.load_module("samplers/auto_sampler")
3335
34-
study = optuna.create_study(sampler=mod.SimulatedAnnealingSampler())
35-
study.optimize(objective, n_trials=20)
36+
study = optuna.create_study(sampler=mod.AutoSampler())
37+
study.optimize(objective, n_trials=10)
3638
3739
print(study.best_trial.value, study.best_trial.params)
3840

0 commit comments

Comments
 (0)