plot_pareto_front
Visualize the Pareto front for multi-objective optimization results, specifying objective targets and including dominated trials, to analyze optimal trade-offs effectively.
Instructions
Return the Pareto front plot as an image for multi-objective optimization.
Args:
target_names:
Objective name list used as the axis titles. If :obj:`None` is specified,
"Objective {objective_index}" is used instead. If ``targets`` is specified
for a study that does not contain any completed trial,
``target_name`` must be specified.
include_dominated_trials:
A flag to include all dominated trial's objective values.
targets:
A list of indices to specify the objective values to display.
Note that this is 0-indexed, i.e., to plot the first and second objective value, set this to [0, 1].
If the number of objectives is neither 2 nor 3, ``targets`` must be specified.
By default, all objectives are displayed.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include_dominated_trials | No | ||
| target_names | No | ||
| targets | No |
Implementation Reference
- optuna_mcp/server.py:455-483 (handler)The handler function for the 'plot_pareto_front' tool. It generates a Pareto front visualization using Optuna's plotting function and returns it as a PNG image via the MCP Image type. The @mcp.tool() decorator registers this function as a tool.@mcp.tool() def plot_pareto_front( target_names: list[str] | None = None, include_dominated_trials: bool = True, targets: list[int] | None = None, ) -> Image: """Return the Pareto front plot as an image for multi-objective optimization. Args: target_names: Objective name list used as the axis titles. If :obj:`None` is specified, "Objective {objective_index}" is used instead. If ``targets`` is specified for a study that does not contain any completed trial, ``target_name`` must be specified. include_dominated_trials: A flag to include all dominated trial's objective values. targets: A list of indices to specify the objective values to display. Note that this is 0-indexed, i.e., to plot the first and second objective value, set this to [0, 1]. If the number of objectives is neither 2 nor 3, ``targets`` must be specified. By default, all objectives are displayed. """ fig = optuna.visualization.plot_pareto_front( mcp.study, target_names=target_names, include_dominated_trials=include_dominated_trials, targets=targets, ) return Image(data=plotly.io.to_image(fig), format="png")