KEMBAR78
Fix PD plots in py3 by jameswex · Pull Request #2669 · tensorflow/tensorboard · GitHub
Skip to content

Conversation

@jameswex
Copy link
Contributor

  • Motivation for features / changes
    PD plots didn't work at all in notebook mode with py3 kernels.

  • Technical description of changes

Ensure string feature values used in PD plot generation are sent to JS as strings for json serialization, not as bytes, to avoid failing serialization.
Correctly use the bytes when running in py3 as that is what tf.Example expects for bytes_list, whereas in py2 it functions on strings.
Make use of six.bytes_type and encode and decode functions to correctly handle this.

  • Detailed steps to verify changes work correctly (as executed by you)

Ran notebooks in py2 and py3 with this change and verified that PD plots are shown correctly (with correct values as well) for both numeric and categorical features.

@jameswex
Copy link
Contributor Author

@tolga-b please review

Copy link
Contributor

@tolga-b tolga-b left a comment

Choose a reason for hiding this comment

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

Thank you James, a minor comment.

"""Inits OriginalFeatureList."""
self.feature_name = feature_name
self.original_value = original_value
self.original_value = [
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's better to use ensure_text from six for consistency with #2311.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

actually can't as tensorboard/tensorflow depend on six 1.10.0 which doesn't include the ensure_* functions. our separate witwidget code seems to pull in six 1.12.0 due to transitive dependencies that is why #2311 works for us. so i reverted back to the first implementation and added an explicit dependency in witwidget setup.py on six 1.12.0 to improve the pip package setup dependencies.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, sounds good then.

"""Inits OriginalFeatureList."""
self.feature_name = feature_name
self.original_value = original_value
self.original_value = [ensure_not_binary(v) for v in original_value]
Copy link
Contributor

Choose a reason for hiding this comment

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

v -> human readable name please :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thx

@jameswex jameswex merged commit ded6760 into tensorflow:master Sep 20, 2019
@jameswex jameswex deleted the pdp_py3 branch September 20, 2019 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants