plot_param_importances
Visualize the importance of hyperparameters in optimization studies. Specify parameters, target values, and names to generate a clear plot for analyzing parameter impact on results.
Instructions
Return the parameter importances plot as an image.
Args:
params:
Parameter list to visualize. The default is all parameters.
target:
An index to specify the value to display. To plot nth objective value, set this to n.
Note that this is 0-indexed, i.e., to plot the first objective value, set this to 0.
By default, all objective will be plotted by setting target to None.
target_name:
Target’s name to display on the legend.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | No | ||
| target | No | ||
| target_name | No | Objective Value |
Implementation Reference
- optuna_mcp/server.py:557-583 (handler)The handler function implementing the plot_param_importances tool. It uses Optuna's visualization module to create a parameter importances plot with a PedAnova importance evaluator and returns the plot as a PNG image via the Image type.@mcp.tool() def plot_param_importances( params: list[str] | None = None, target: int | None = None, target_name: str = "Objective Value", ) -> Image: """Return the parameter importances plot as an image. Args: params: Parameter list to visualize. The default is all parameters. target: An index to specify the value to display. To plot nth objective value, set this to n. Note that this is 0-indexed, i.e., to plot the first objective value, set this to 0. By default, all objective will be plotted by setting target to None. target_name: Target’s name to display on the legend. """ evaluator = optuna.importance.PedAnovaImportanceEvaluator() fig = optuna.visualization.plot_param_importances( mcp.study, evaluator=evaluator, params=params, target=(lambda t: t.values[target]) if target is not None else None, target_name=target_name, ) return Image(data=plotly.io.to_image(fig), format="png")