Skip to main content
Glama

plot_contour

Generate contour plot visualizations for hyperparameter optimization results. Specify parameters, target values, and display labels to analyze and interpret optimization data efficiently.

Instructions

Return the contour 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. target_name: Target’s name to display on the color bar.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsNo
targetNo
target_nameNoObjective Value

Implementation Reference

  • The plot_contour tool handler: generates a contour visualization of the Optuna study using optuna.visualization.plot_contour and returns it as a PNG Image.
    @mcp.tool() def plot_contour( params: list[str] | None = None, target: int = 0, target_name: str = "Objective Value", ) -> Image: """Return the contour 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. target_name: Target’s name to display on the color bar. """ fig = optuna.visualization.plot_contour( mcp.study, params=params, target=lambda t: t.values[target], target_name=target_name ) return Image(data=plotly.io.to_image(fig), format="png")

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/optuna/optuna-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server