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.

Make `plot_contour` example more pedagogical

See original GitHub issue

Motivation

Examples in the API reference should be pedagogical. The plot for the contour plot is not with somewhat poorly visible categorical parameter values.

Screen Shot 2020-08-23 at 15 30 02

Description

The contour plot example could use a better suited objective function e.g. limited to floats. The following code was provided by @toshihikoyanase . Maybe we can modify it to only suggest 2 variables to keep it simple and use it here.

def objective(trial):
    x = trial.suggest_float("x", 0, 1)
    y = trial.suggest_float("y", 0, 1)
    z = trial.suggest_float("z", 0, 1)
    return (x - 0.5) ** 2 + (y - 0.2) ** 2 + (z - 0.7) ** 2
  1. Update example code.
  2. Update example image generation script.
  3. Run the script from 2. to generate a new image.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
hvycommented, Aug 23, 2020

Addressing the visibility for categorical samples in the first place might be an issue in itself but this is probably less straight forward since we cannot compute distances between categorical values.

Edit: this is an issue for suggest_int values as well. We might want to consider creating some padding after all.

1reaction
toshihikoyanasecommented, Aug 23, 2020

Thank you @hvy, and let me share my notebook that draws the contour plot using the above objective function.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Teach Your Students to Draw Contour Lines
Teaching contour line is a simple way to hone students' observational drawing skills, preparing them for more advanced drawing activities to ...
Read more >
Contour Basics: JAVA Mac PC - SERC - Carleton
The Contour Activity (more info) is a great on-line resource for introducing students to contour plots. The lessons:.
Read more >
Contour plot of matrix - MATLAB contour - MathWorks
This MATLAB function creates a contour plot containing the isolines of matrix Z, where Z contains height values on the x-y plane.
Read more >
How to Create a Contour Plot in Matplotlib
Example 1 – Draw a simple contour plot. Let's use the matplotlib.pyplot.contour() function to create a simple contour plot. import numpy as np....
Read more >
Nonlinear Programming Contour Map Optimization - YouTube
A contour plot of the objective and constraints is useful in exploring the feasible region (potential solutions) and boundaries for a simple ...
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