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

Adds specialized formatter to histogram component. #5818

Merged
merged 5 commits into from Jul 27, 2022

Conversation

bileschi
Copy link
Collaborator

  • Motivation for features / changes
    Using SI notation for histogram bins smaller than 1 causes confusion. '500m' can mean many things, not just '0.5'. Googlers see b/238492397

  • Technical description of changes
    Replaces tick formatter with a 3 way switch. SI notation for small values, Exponential notation for large values, and natural notation for middle values.

  • Screenshots of UI changes

before:

image
image

after:

image
image

  • Detailed steps to verify changes work correctly (as executed by you)
    Ran TensorBoard standalone locally and compared across a very wide range of histogram bin bucket sizes.

  • Alternate designs / implementations considered
    It may be possible to update tensorboard/webapp/widgets/histogram/histogram_component.ts and re-use formatters from there. Did not pursue as it would require extra customization there, and this was deemed sufficiently clear.

@bileschi bileschi requested a review from bmd3k July 22, 2022 21:38
Copy link
Contributor

@rileyajones rileyajones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines 96 to 102
if (absNum >= LARGE_NUMBER){
return d3LargeFormatter(x);
}
if (absNum < SMALL_NUMBER){
return d3SmallFormatter(x);
}
return d3MiddleFormatter(x);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very nitpicky but it's a little strange that this is ordered LARGE_NUMBER, SMALL_NUMBER, MEDIUM_NUMBER.

Perhaps consider gating around a series minimums.

Suggested change
if (absNum >= LARGE_NUMBER){
return d3LargeFormatter(x);
}
if (absNum < SMALL_NUMBER){
return d3SmallFormatter(x);
}
return d3MiddleFormatter(x);
if (absNum >= LARGE_NUMBER){
return d3LargeFormatter(x);
}
if (absNum >= SMALL_NUMBER){
return d3MiddleFormatter(x);
}
return d3SmallFormatter(x);

If taking this suggestion you might also consider renaming SMALL_NUMBER to MEDIUM_NUMBER.

Copy link
Contributor

@bmd3k bmd3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add some tests if it is reasonable to do.

@bileschi
Copy link
Collaborator Author

Factored out the formatter and added tests.

@bileschi bileschi requested a review from bmd3k July 25, 2022 21:22
@bileschi bileschi merged commit c52d138 into tensorflow:master Jul 27, 2022
Copy link
Contributor

@bmd3k bmd3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little late but LGTM. Thanks!

yatbear pushed a commit to yatbear/tensorboard that referenced this pull request Mar 27, 2023
dna2github pushed a commit to dna2fork/tensorboard that referenced this pull request May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants