question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nzw0301commented, May 31, 2021

Brilliant! Thank you for sharing your investigation. It sounds great – reviewers can understand the change in the pull request smoothly.

1reaction
01-vyomcommented, May 31, 2021

I was reading the provided link for interpolation of irregular space data and tried the CubicInterpolation code [interpolating z], still got the same results (incorrect numeric range). The Linear interpolation and the option linear in the griddata function works in the same way, so we can just use that if we go for linear interpolation. Let me know your thoughts…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Contour plots in Python - Plotly
A 2D contour plot shows the contour lines of a 2D numerical array z , i.e. interpolated lines of isovalues of z ....
Read more >
Contour Plots using Plotly in Python - GeeksforGeeks
A contour plot has a function of two variables of curves along which the function has constant values so that these curves join...
Read more >
Chapter 4. Visualization with Matplotlib - O'Reilly
We can see that this scatter plot has given us the ability to simultaneously explore four different dimensions of the data: the (x,...
Read more >
Plotting with Plotly — hvPlot 0.8.2 documentation
This page demonstrates the use of the Plotly plotting backend, ... example here we will plot the departure delay ('depdelay') as a function...
Read more >
Data Visualization(2D/3D): 35+ Exercises - Kaggle
Depending on what backends you have installed, many different file formats ... Adjusting the Plot: Axes Limits # Matplotlib does a decent job...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found