optuna_dashboard.save_plotly_graph_object

optuna_dashboard.save_plotly_graph_object(study, figure, *, graph_object_id=None)

Save the user-defined plotly’s graph object to the study.

Example

import optuna
from optuna_dashboard import save_plotly_graph_object

def objective(trial):
    x = trial.suggest_float("x", -100, 100)
    y = trial.suggest_categorical("y", [-1, 0, 1])
    return x**2 + y

study = optuna.create_study()
study.optimize(objective, n_trials=100)

figure = optuna.visualization.plot_optimization_history(study)
save_plotly_graph_object(study, figure)
Parameters:
  • study (Study) – Target study object.

  • plot_data – The plotly’s graph object to save.

  • graph_object_id (str | None) – Unique identifier of the graph object. If specified, the graph object is overwritten. This must be a valid HTML id attribute value.

  • figure (go.Figure)

Returns:

The graph object ID.

Return type:

str