A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://optuna.readthedocs.io/en/stable/tutorial/10_key_features/004_distributed.html below:

Website Navigation


Easy Parallelization — Optuna 4.4.0 documentation

Easy Parallelization

It’s straightforward to parallelize optuna.study.Study.optimize().

If you want to manually execute Optuna optimization:

  1. start an RDB server (this example uses MySQL)

  2. create a study with --storage argument

  3. share the study among multiple nodes and processes

Of course, you can use Kubernetes as in the kubernetes examples.

To just see how parallel optimization works in Optuna, check the below video.

Create a Study

You can create a study using optuna create-study command. Alternatively, in Python script you can use optuna.create_study().

$ mysql -u root -e "CREATE DATABASE IF NOT EXISTS example"
$ optuna create-study --study-name "distributed-example" --storage "mysql://root@localhost/example"
[I 2020-07-21 13:43:39,642] A new study created with name: distributed-example

Then, write an optimization script. Let’s assume that foo.py contains the following code.

import optuna


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


if __name__ == "__main__":
    study = optuna.load_study(
        study_name="distributed-example", storage="mysql://root@localhost/example"
    )
    study.optimize(objective, n_trials=100)

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4