Skip to content

Commit

Permalink
Merge pull request #215 from nabenabe0928/add-simplest-example-direct…
Browse files Browse the repository at this point in the history
…ly-to-readme

Add the simplest example directly to README
  • Loading branch information
contramundum53 authored Oct 16, 2023
2 parents 3411a75 + 00bac45 commit f54fe1b
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 f54fe1b

Please sign in to comment.