Skip to content

How to Visualize Optimization Results

Interactive notebook

See the companion notebook for a runnable example. View ยท Open in marimo

This guide shows you how to plot optimization history and parameter relationships from a completed OptunaSearchCV search. Use this when you need to inspect convergence behavior or identify important parameter regions.

Prerequisites

  • Sklearn-Optuna installed (Getting Started)
  • A completed OptunaSearchCV search
  • Plotly installed (uv add plotly)

Access the Study

After calling fit(), the Optuna study is available as search.study_:

search.fit(X, y)
study = search.study_

Pass this study object to any of Optuna's built-in visualization functions.

Plot Optimization History

Show how the objective value changed over trials:

import optuna

fig = optuna.visualization.plot_optimization_history(study)
fig.show()

This helps identify whether the search converged or would benefit from more trials.

Plot Parameter Contours

Visualize the relationship between two parameters and the objective:

fig = optuna.visualization.plot_contour(study)
fig.show()

Contour plots highlight regions of the parameter space that produce the best scores.

Plot Parameter Importances

Rank parameters by their impact on the objective:

fig = optuna.visualization.plot_param_importances(study)
fig.show()

Use this to decide which parameters are worth tuning further and which can be fixed.

See Also