Skip to content

The objective range of Matplotlib contour plot has a different numerical range from Plotly backend #2595

@nzw0301

Description

@nzw0301

Expected behavior

The range of objective in optuna.visualization.matplotlib.plot_contour should have a similar range to optuna.visualization.plot_contour.

Environment

  • Optuna version: 2.7.0
  • Python version: 3.8.8
  • OS: Mac
  • (Optional) Other libraries and their versions:
    • matplotlib: 3.3.4
    • Plotly: 4.11.0

Error messages, stack traces, or logs

The matplotlib range is from -60 000 to 360 000 as in the following figure.

download (2)

On the other hand, Plotly's range is from 0 to 9 000. That is supposed to be true.

newplot (2)

Steps to reproduce

  1. Please run a following example code blocks

Reproducible examples (optional)

import optuna


def objective(trial):
    x = trial.suggest_uniform('x', -100, 100)
    y = trial.suggest_categorical('y', list(range(-10, 10)))
    z = trial.suggest_uniform('z', -100, 100)
    return x ** 2 + y - z

study = optuna.create_study(sampler=optuna.samplers.TPESampler(seed=7))
study.optimize(objective, n_trials=200)

optuna.visualization.matplotlib.plot_contour(study, params=['y', 'z'])
optuna.visualization.plot_contour(study, params=['y', 'z']) # plotly

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue/PR about behavior that is broken. Not for typos/examples/CI/test but for Optuna itself.contribution-welcomeIssue that welcomes contribution.optuna.visualizationRelated to the `optuna.visualization` submodule. This is automatically labeled by github-actions.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions