Skip to content

Commit

Permalink
Merge pull request #124 from y0z/feature/add-whale-ipynb
Browse files Browse the repository at this point in the history
Add example.ipynb
  • Loading branch information
toshihikoyanase authored Aug 2, 2024
2 parents 03b7ead + 98e94d6 commit 1d7ef9a
Show file tree
Hide file tree
Showing 3 changed files with 193 additions and 8 deletions.
9 changes: 3 additions & 6 deletions package/samplers/whale_optimization/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ license: MIT License

## Example

[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/optuna/optunahub-registry/blob/main/package/samplers/whale_optimization/example.ipynb)

```python
from __future__ import annotations

Expand All @@ -32,12 +34,7 @@ if __name__ == "__main__":
y = trial.suggest_float("y", -10, 10)
return x**2 + y**2

sampler = WhaleOptimizationSampler(
{
"x": optuna.distributions.FloatDistribution(-10, 10),
"y": optuna.distributions.FloatDistribution(-10, 10),
}
)
sampler = WhaleOptimizationSampler()
study = optuna.create_study(sampler=sampler)
study.optimize(objective, n_trials=100)
optuna.visualization.matplotlib.plot_optimization_history(study)
Expand Down
Loading

0 comments on commit 1d7ef9a

Please sign in to comment.