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

What-If Tool: Add ability to sort PD plots by interestingness #2461

Merged
merged 10 commits into from
Sep 17, 2019

Conversation

jameswex
Copy link
Contributor

@jameswex jameswex commented Jul 25, 2019

  • Motivation for features / changes

Long-standing feature request to allow the tool to sort all features by how interesting their partial dependence plots are, to help users explore that space in a more directed manner.

  • Technical description of changes

Add new backend capability to sort features by how interesting their PD plots are (for a given selected example, or globally for all examples, depending on user selection). This is done by measuring the Y-axis movement in each PD plot for each feature and sorting them by this measure.
Add new button to run this sort, which runs in the background and can take a while. Therefore added a spinner on the button to show it is calculating
Add path in all implementations (TensorBoard, jupyter, and colab) to handle this sort request and return the response
Add UI to indicate features for which the PD plot is completely flat. These features are grayed-out and at the bottom of the sorted list
Added unit tests for new python code
Updated all demos to be able to handle sorting of eligible features in JS for demo purposes

  • Screenshots of UI changes

During sorting processing:
pdthinking

After sorting:
aftersort

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

Ran demos and used feature. Verified correct sorting.
Ran TensorBoard, colab notebooks, and jupyter notebooks and used feature to verify it works through all code paths.
Ran unit tests of new py code

@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. I have some comments on design decision. Still working on checking the code for demos.

Categorical features are repesented as
{name: samples:[] interestingness:}.
"""
try:
Copy link
Contributor

Choose a reason for hiding this comment

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

Some design related comments:
First, do we need to recompute all PDPs just for sorting although they exist on the js side?
Second, we could probably move this code to js side by unpacking chart data from containers found by featureContainerByName. Do you think its better to have it on python side for future flexibility?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As discussed, they only exist for a given feature on JS side if the feature has been expanded, so there is no way to access all plots of JS without having python compute all of them.

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good!

this.makeAsyncRequest_(url,
setEligibleFields, null, 'plot ordering', sortErrorCallback.bind(this));
} else {
urlParams['features'] = this.partialDepPlotEligibleFeatures;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Not sure which is faster, but we could pass this to TensorBoard version as well so you don't have to call python get_eligible_features again. Not necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that part isn't the bottleneck of this operation, the generating of all PD plots for all features is. so i don't think its necessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

sounds good.

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.

Looks good to me, thank you James :)

@@ -119,6 +119,11 @@ var WITView = widgets.DOMWidgetView.extend({
this.touch();
});

this.view_.addEventListener('sort-eligible-features', (e) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

if examples get updated, will e.detail change to trigger sort again? Do we need a counter?

@stephanwlee stephanwlee requested review from davidsoergel and removed request for stephanwlee September 11, 2019 18:25
@stephanwlee
Copy link
Contributor

stephanwlee commented Sep 11, 2019

Onduty: redirecting the review to team member, davidsoergel, to load balance.

@jameswex
Copy link
Contributor Author

@davidsoergel can you please review? Thanks.

@davidsoergel
Copy link
Member

davidsoergel commented Sep 13, 2019 via email

Copy link
Member

@davidsoergel davidsoergel left a comment

Choose a reason for hiding this comment

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

Largely LGTM, just a couple minor questions :)

Copy link
Contributor Author

@jameswex jameswex left a comment

Choose a reason for hiding this comment

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

made changes per review

@jameswex jameswex merged commit 34ac7b0 into tensorflow:master Sep 17, 2019
@jameswex jameswex deleted the sort_features branch September 17, 2019 13:22
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.

5 participants