Tensorboard: Scalars: Simple Way of Setting y axis to start at 0

Created on 16 Jun 2017  路  12Comments  路  Source: tensorflow/tensorboard

Migrated from https://github.com/tensorflow/tensorflow/issues/7631

I have a number of scalars that I plot in tensorboard that are non negative values (ie accuracy, etc). It would be cool if there was a quick way to have the y axis start at 0 rather than allocating unused space in the negative y direction.
image

scalars contributions welcome feature

Most helpful comment

I think the right way to do this would be to add another argument to the scalar_summary:

tb.plugins.scalar.summary(name, value, ... , y_axis=[0, None])

y_axis would take a tuple of numbers, where None means default behavior, and a number means fix the bound to that exact number. The first number would be the lower bound, the second would be the upper bound.

All 12 comments

I think the right way to do this would be to add another argument to the scalar_summary:

tb.plugins.scalar.summary(name, value, ... , y_axis=[0, None])

y_axis would take a tuple of numbers, where None means default behavior, and a number means fix the bound to that exact number. The first number would be the lower bound, the second would be the upper bound.

Oh, and the extra argument would get proxied to the scalars plugin via SummaryMetadata. Note we still need to get support for SummaryMetadata into released TensorFlow (right now it is in HEAD but not 1.2).

@dandelionmane
May I try this issue? I'll follow your suggestions above.

Sure. Just so you know, it will probably be a tricky change that will require a few iterations to get right.
Here are the steps, (can be done in different order):

  • Modify the vz-line-chart so that there is a setting for explicitly configuring the y scale domain
  • Modify the scalars plugin so that it has a route for providing metadata on what the y scale domain is for a given tag. It would be nice to do this in a way where we can use it as a general pattern across plugins for retrieving per-tag metadata (we might want to include it in the index route)
  • Modify the tf-scalars-dashboard so that it uses this new metadata from the route to properly set the setting on individual charts
  • Add a scalars() method in tensorboard/plugins/scalars/__init__ that creates a summary op using SummaryMetadata to get this new information from the api to the text plugin, kind of like here, except instead of making an empty TextPluginData, we define a new ScalarPluginData proto that has the needed fields. I would do this one last as it will be easier if we wait a bit for dust to settle on the TensorFlow and TensorBoard API side. When we get to this point, I'll help you as it it's somewhat complex and there aren't many examples yet.

@wchargin your thoughts are appreciated too

Would it be sufficient to add a toggle on the frontend? You could output the exact same summary data and just select at viewing time what axis behavior you want. If you're okay with doing this each time you launch the instance, it could be a better solution鈥攎uch easier to implement, doesn't require changing TF goldens, etc.

The work items would be

  • Modify vz-line-chart so that there is a setting for explicitly configuring the _y_ scale domain.
  • Add a tf-option-selector (or similar) to the tf-scalar-dashboard, and thread the output through to the tf-scalar-chart and vz-line-chart.

Hmm, William's solution is indeed a lot easier to implement.

One thing we could do is have it be a per-chart setting, with a toggle a-la "toggleLogScale" button.
Then, if down the road we want to have it be configurable at the tf.summary level, we can re-use the work of building the setting with button, and add wiring to the backend. But it would be a lot easier to implement it as a frontend-only feature to start.

@chris-chris what do you think?

Also a good idea. Adding it as a per-chart setting would be even easier to implement than having it be a global setting, and鈥攏ow that you mention it鈥攊s probably a better idea, anyway: we shouldn't force all your scalars to have the same window.

@dandelionmane @wchargin
Per-chart setting looks great. And I'll make it frontend-only feature first.
Thank you for your guidance and useful advice.

Related #710

Please note that it is common to have multiple graphs (e.g. scalars) that are expected to be aligned to the same Y axis values.
Setting a front-end-only option, means that one is required to mark those graphs again and again, every time he loads the boards.
It is possible, of course, to save those flags locally.

Any updates on this?

No updates to report. We've had some other related questions about being able to customize the axis ranges (or "lock" them to be the same across charts) so I think we'd want to address this as part of a holistic improvement there.

Was this page helpful?
0 / 5 - 0 ratings