Merge pull request #313 from c-bata/update-getting-started

Update the getting started section of README
This commit is contained in:
Masashi Shibata
2022-12-15 20:44:30 +09:00
committed by GitHub
+24 -3
View File
@@ -6,7 +6,7 @@
Real-time dashboard for [Optuna](https://github.com/optuna/optuna).
Code files were originally taken from [Goptuna](https://github.com/c-bata/goptuna).
## Getting Started
## Installation
You can install optuna-dashboard via [PyPI](https://pypi.org/project/optuna-dashboard/) or [Anaconda Cloud](https://anaconda.org/conda-forge/optuna-dashboard).
@@ -14,13 +14,34 @@ You can install optuna-dashboard via [PyPI](https://pypi.org/project/optuna-dash
$ pip install optuna-dashboard
```
And you can also install following optional dependencies to make optuna-dashboard faster.
Also you can install following optional dependencies to make optuna-dashboard faster.
```console
$ pip install optuna-fast-fanova gunicorn
```
Then please execute `optuna-dashboard` command with Optuna storage URL.
## Getting Started
First, please specify the storage URL to persistent your study using the [RDB backend](https://optuna.readthedocs.io/en/stable/tutorial/20_recipes/001_rdb.html).
```python
import optuna
def objective(trial):
x = trial.suggest_float("x", -100, 100)
y = trial.suggest_categorical("y", [-1, 0, 1])
return x**2 + y
if __name__ == "__main__":
study = optuna.create_study(
storage="sqlite:///db.sqlite3", # Specify the storage URL here.
study_name="quadratic-simple"
)
study.optimize(objective, n_trials=100)
print(f"Best value: {study.best_value} (params: {study.best_params})")
```
After running the above script, please execute the `optuna-dashboard` command with Optuna storage URL.
```
$ optuna-dashboard sqlite:///db.sqlite3