Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scalar plots should have true log scaling option #938

Closed
gonnet opened this issue Feb 2, 2018 · 8 comments
Closed

Scalar plots should have true log scaling option #938

gonnet opened this issue Feb 2, 2018 · 8 comments

Comments

@gonnet
Copy link
Contributor

gonnet commented Feb 2, 2018

Logarithmic scaling for scalar summaries is broken in several ways:

  • Y-axis shows negative values, negative values are plotted as -log(-y).
  • Values are scaled logarithmically down to ~0.1, below that linearly to zero.

log_scaling_this_is_not

I'm guessing this was done to make accidental plotting of not strictly positive values less painful for the inexperienced user, but it makes the whole thing kind of useless for the rest of us. E.g. if I have some loss that converges gently towards zero, I'm actually quite interested in seeing how it behaves below 0.1. Plotting values linearly below that range makes them mostly indistinguishable.

Are there any plans to fix this, or can we add a setting to enable genuine logarithmic scaling for non-novice users?

@nfelt
Copy link
Contributor

nfelt commented Feb 22, 2018

Yes, the "log" scale is actually a "ModifiedLog" scale:

"A ModifiedLog Scale acts as a regular log scale for large numbers. As it approaches 0, it gradually becomes linear. Consequently, a ModifiedLog Scale can process 0 and negative numbers."
http://plottablejs.org/docs/classes/plottable.scales.modifiedlog.html

I agree that at a minimum there should be some ability to control the point at which the linearization begins, and probably it would be best to have a true log scale option (though this is a little more work to implement). Here's a few questions that could help guide what this looks like:

  • What should the plots do for 0 values or negative numbers? Should those just be omitted entirely? Should there be some kind of warning on the plot?

  • Do people think there's any value at all in the existing ModifiedLog scale (maybe with an adjusted base point), i.e. would they want to see two different scale options? Or is the desire to just replace the current log scale button with a true log scale?

@nfelt nfelt changed the title Logarithmic scaling for scalar summaries is weird. Scalar plots should have true logarithmic scaling option Feb 22, 2018
@nfelt nfelt changed the title Scalar plots should have true logarithmic scaling option Scalar plots should have true log scaling option Feb 22, 2018
@shoyer
Copy link

shoyer commented Feb 23, 2018

What should the plots do for 0 values or negative numbers? Should those just be omitted entirely? Should there be some kind of warning on the plot?

Simply not showing them would be a reasonable option -- better than what we currently have. It's always easy to switch back to linear scaling if necessary.

I think my favorite option would be ignoring them in setting axis-boundaries and then showing vertical lines diverging off the screen, like matplotlib:

>>> import matplotlib.pyplot as plt
>>> plt.semilogy([1, 2, 3, 4, -1, 6, 7, 8, -1, 9, 10])

image

One thing that would be best to avoid is simply dropping invalid plots and showing straight lines between the remaining valid values. This could led to the misleading impression that there are no negative values.

Do people think there's any value at all in the existing ModifiedLog scale (maybe with an adjusted base point), i.e. would they want to see two different scale options?

I have been doing scientific visualization for over a decade now. I've used a log scale many times, but I can only think of one case where I've seen a variation on a modified log-scale used (and it wasn't in machine learning). It's just not a standard visualization technique. So my preference would be to for dropping it entirely, though I would not be strongly opposed to keeping it as an option.

@gonnet
Copy link
Contributor Author

gonnet commented Feb 23, 2018

What should the plots do for 0 values or negative numbers? Should those just be omitted entirely? Should there be some kind of warning on the plot?

I'm also for the vertical lines, as suggested by @shoyer, ideally making them dotted 😃

Do people think there's any value at all in the existing ModifiedLog scale (maybe with an adjusted base point), i.e. would they want to see two different scale options? Or is the desire to just replace the current log scale button with a true log scale?

Good question. I for one will definitely not miss the modified logging if it goes away, but I am only I. One option might be to make the modified log scaling opt-in and to see if anybody notices/complains. Any decision in favour of one or the other could be based on usage statistics.

@yk5
Copy link

yk5 commented Apr 19, 2018

Would it be hard to make the button with tri-state (linear/log/modified log) instead of toggling between the two? The Icon would need to be carefully designed though.

@shoyer
Copy link

shoyer commented Apr 19, 2018

@yk5 do you have use cases for modified log scaling?

@yk5
Copy link

yk5 commented Apr 19, 2018 via email

@shoyer
Copy link

shoyer commented Apr 19, 2018

This issue is a duplicate of #57

@nfelt
Copy link
Contributor

nfelt commented Apr 24, 2018

Duplicate of #57

@shoyer thanks for pointing that out. Since that issue predates this one by a year, I'll close this one in favor of the pre-existing issue, so please follow along on #57 if interested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants