Skip to content

Commit

Permalink
Rename load to load_module
Browse files Browse the repository at this point in the history
  • Loading branch information
HideakiImamura committed May 15, 2024
1 parent 8d00a9a commit e5d6fd4
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package/samplers/demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def objective(trial: optuna.Trial) -> float:


if __name__ == "__main__":
module = optunahub.load("samplers/demo")
module = optunahub.load_module("samplers/demo")
sampler = module.DemoSampler(seed=42)
study = optuna.create_study(sampler=sampler)
study.optimize(objective, n_trials=5)
Expand Down
2 changes: 1 addition & 1 deletion package/samplers/simple/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ from optuna.trial import FrozenTrial


class UserDefinedSampler(
optunahub.load("sampler/simple").SimpleSampler
optunahub.load_module("sampler/simple").SimpleSampler
):
def __init__(self, search_space: dict[str, BaseDistribution]) -> None:
super().__init__(search_space)
Expand Down
2 changes: 1 addition & 1 deletion package/samplers/simulated_annealing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def objective(trial: optuna.Trial) -> float:


if __name__ == "__main__":
mod = optunahub.load("sampler/simulated_annealing")
mod = optunahub.load_module("sampler/simulated_annealing")

sampler = mod.SimulatedAnnealingSampler()
study = optuna.create_study(sampler=sampler)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def objective(trial):


if __name__ == "__main__":
mod = optunahub.load("visualization/plot_hypervolume_history_with_rp")
mod = optunahub.load_module("visualization/plot_hypervolume_history_with_rp")

study = optuna.create_study(directions=["minimize", "minimize"])
study.optimize(objective, n_trials=50)
Expand Down
4 changes: 2 additions & 2 deletions recipes/001_first.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
###################################################################################################
# Next, define your own sampler class by inheriting `SimpleSampler` class.
# In this example, we implement a sampler that always returns a random value.
# The `SimpleSampler` class can be loaded using `optunahub.load` function.
# The `SimpleSampler` class can be loaded using `optunahub.load_module` function.
# The `force_load` argument is set to `True` to force loading the sampler without caching and consent to use stats.

SimpleSampler = optunahub.load(
SimpleSampler = optunahub.load_module(
"samplers/simple",
auth=Auth.Token(os.environ["SECRET_GITHUB_TOKEN"]),
).SimpleSampler
Expand Down

0 comments on commit e5d6fd4

Please sign in to comment.