Skip to content

Commit

Permalink
Add the simplest example directly to README
Browse files Browse the repository at this point in the history
  • Loading branch information
nabenabe0928 committed Oct 16, 2023
1 parent 3411a75 commit 00bac45
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,26 @@ Optuna Examples

This page contains a list of example codes written with Optuna.

The simplest codeblock looks like this:

```python
import optuna


def objective(trial):
x = trial.suggest_float("x", -100, 100)
return x ** 2


if __name__ == "__main__":
study = optuna.create_study()
# The optimization finishes after evaluating 1000 times or 3 seconds.
study.optimize(objective, n_trials=1000, timeout=3)
print(f"Best params is {study.best_params} with value {study.best_value}")
```

The examples below provide codeblocks similar to the example above for various different scenarios.

### Simple Black-box Optimization

* [Quadratic function](./quadratic_simple.py)
Expand Down

0 comments on commit 00bac45

Please sign in to comment.