-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix PD plots in py3 #2669
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
Fix PD plots in py3 #2669
Conversation
|
@tolga-b please review |
There was a problem hiding this 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 = [ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, thx
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.
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.