Optuna Dashboard

0.20.0 · active · verified Thu Apr 16

Optuna Dashboard is a real-time web dashboard for Optuna, a popular hyperparameter optimization framework. It allows users to visualize and analyze hyperparameter optimization studies in real-time through interactive graphs and a rich trials data grid. The current version is 0.20.0, and it maintains a regular release cadence, with updates typically published more than 12 times a year.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart runs an Optuna optimization study and persists its results to an SQLite database. You can then launch the Optuna Dashboard from your terminal, pointing to this database URL to visualize the study in real-time. The dashboard typically listens on `http://localhost:8080/`.

import optuna
import os

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__":
    # Ensure the directory for the database exists
    os.makedirs("db", exist_ok=True)
    storage_url = "sqlite:///db/optuna_study.sqlite3"
    study = optuna.create_study(
        storage=storage_url,
        study_name="quadratic-simple",
        load_if_exists=True # Load existing study if it exists
    )
    print("Starting optimization...")
    study.optimize(objective, n_trials=10)
    print(f"Best value: {study.best_value} (params: {study.best_params})")
    print(f"Launch dashboard with: optuna-dashboard {storage_url}")
    print("Or via Python API (uncomment below):\n# from optuna_dashboard import run_server\n# run_server(storage_url)")

view raw JSON →