Note
Go to the end to download the full example code.
plot_param_importances
- optuna.visualization.plot_param_importances(study, evaluator=None, params=None, *, target=None, target_name='Objective Value')[source]
Plot hyperparameter importances (
PedAnovaImportanceEvaluatorby default).See also
This function visualizes the results of
optuna.importance.get_param_importances().- Parameters:
study (Study) – An optimized study.
evaluator (BaseImportanceEvaluator | None) –
An importance evaluator object that specifies which algorithm to base the importance assessment on. Defaults to
PedAnovaImportanceEvaluator. For details on this evaluator, please refer to the following papers:PED-ANOVA: Efficiently Quantifying Hyperparameter Importance in Arbitrary Subspaces (IJCAI 2023)
Conditional PED-ANOVA: Hyperparameter Importance in Hierarchical & Dynamic Search Spaces (KDD 2026)
When using this evaluator in your project, please consider citing both papers.
Note
Optuna Dashboard also uses
PedAnovaImportanceEvaluator, the default importance evaluator.params (list[str] | None) – A list of names of parameters to assess. If
None,PedAnovaImportanceEvaluatorassesses all parameters that appear in completed trials, including conditional parameters, while other evaluators assess parameters present in all completed trials. If specified, only the specified parameters are assessed. When usingPedAnovaImportanceEvaluator, each specified parameter must appear in at least one completed trial. When using other evaluators, at least one completed trial must contain all specified parameters.target (Callable[[FrozenTrial], float] | None) – A function that returns the value used to evaluate and display importances. If
None, objective values are used for single-objective optimization. For multi-objective optimization, all objectives will be plotted iftargetisNone. Specifytarget, for exampletarget=lambda t: t.values[0], to plot importances for a specific objective.target_name (str) – Target’s name to display on the legend. Names set via
set_metric_names()will be used iftargetisNone, overriding this argument.
- Returns:
A
plotly.graph_objects.Figureobject.- Return type:
go.Figure
The following code snippet shows how to plot hyperparameter importances.
import optuna
from plotly.io import show
def objective(trial):
x = trial.suggest_int("x", 0, 2)
y = trial.suggest_float("y", -1.0, 1.0)
z = trial.suggest_float("z", 0.0, 1.5)
return x**2 + y**3 - z**4
sampler = optuna.samplers.RandomSampler(seed=10)
study = optuna.create_study(sampler=sampler)
study.optimize(objective, n_trials=100)
fig = optuna.visualization.plot_param_importances(study)
show(fig)
Total running time of the script: (0 minutes 0.188 seconds)