Skip to content

Commit

Permalink
Update tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
y0z committed Aug 23, 2024
1 parent a5a6585 commit a8119f6
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions recipes/001_first.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
Usually, Optuna provides ``BaseSampler`` class to implement your own sampler.
However, it is a bit complicated to implement a sampler from scratch.
Instead, in OptunaHub, you can use `samplers/simple/SimpleBaseSampler <https://github.com/optuna/optunahub-registry/blob/main/package/samplers/simple/__init__.py>`__ class, which is a sampler template that can be easily extended.
Instead, in OptunaHub, you can use `optunahub.samplers.SimpleBaseSampler <https://optuna.github.io/optunahub/generated/optunahub.samplers.SimpleBaseSampler.html>`__ class, which is a sampler template that can be easily extended.
You need to install ``optuna`` to implement your own sampler, and ``optunahub`` to use the template ``SimpleBaseSampler``.
Expand All @@ -39,14 +39,9 @@
###################################################################################################
# Next, define your own sampler class by inheriting ``SimpleBaseSampler`` class.
# In this example, we implement a sampler that returns a random value.
# ``SimpleBaseSampler`` class can be loaded using ``optunahub.load_module`` function.
# ``force_reload=True`` argument forces downloading the sampler from the registry.
# If we set ``force_reload`` to :obj:`False`, we use the cached data in our local storage if available.

SimpleBaseSampler = optunahub.load_module("samplers/simple").SimpleBaseSampler


class MySampler(SimpleBaseSampler): # type: ignore
class MySampler(optunahub.samplers.SimpleBaseSampler):
# By default, search space will be estimated automatically like Optuna's built-in samplers.
# You can fix the search spacd by `search_space` argument of `SimpleSampler` class.
def __init__(
Expand Down

0 comments on commit a8119f6

Please sign in to comment.