xadrianzetx / optuna-distributed

Distributed hyperparameter optimization made easy
MIT License
34 stars 1 forks source link

optuna.visualization plotting support #80

Closed xKDHx closed 1 year ago

xKDHx commented 1 year ago

Any plans to add optuna.visualization plotting support?

xadrianzetx commented 1 year ago

For now you can use optuna.visualization by passing the original study like so:

import optuna
import optuna_distributed

def objective(trial):
    # Binh and Korn function.
    x = trial.suggest_float("x", 0, 5)
    y = trial.suggest_float("y", 0, 3)

    v0 = 4 * x**2 + 4 * y**2
    v1 = (x - 5) ** 2 + (y - 5) ** 2
    return v0, v1

study = optuna_distributed.from_study(
    optuna.create_study(directions=["minimize", "minimize"])
)
study.optimize(objective, n_trials=100)

optuna.visualization.plot_pareto_front(study._study).show()

It's a bit hacky to access a private field of DistributedStudy though, so I'll try to support it properly soon.

xKDHx commented 1 year ago

Thanks, that's an easy work around. Great work on the project btw, I've been using it for a few weeks now and all running smoothly :)