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

Visualization of GNN Explanations #5631

Closed
3 tasks done
RexYing opened this issue Oct 7, 2022 · 9 comments
Closed
3 tasks done

Visualization of GNN Explanations #5631

RexYing opened this issue Oct 7, 2022 · 9 comments

Comments

@RexYing
Copy link
Contributor

RexYing commented Oct 7, 2022

🚀 The feature, motivation and pitch

Improve visualization utility functions of the explanation. It can be in the form of feature importance maps, or visualization of the explanation subgraph. Support parameters such as the size of explanation and show weighted importance for edges to control the visualization output.

Plan:

  • Explanation subgraph visualization for thresholded explanation. The output would be a visualization of the explanation subgraph after filtering out edges according to their importance / mask values (by a threshold).
  • Explanation subgraph visualization for non-threshold explanation. Potentially plot the whole graph or the neighborhood graph, where edge width / color depends on the importance value of each edge.
  • Visualize feature importance. Draw a bar plot that corresponds to the importance of each feature dimension (and sort them).

Alternatives

No response

Additional context

No response

@rjurney
Copy link

rjurney commented Oct 8, 2022

This would be great!

@davodogster
Copy link

Yes this would be great!

@sebastian-montero
Copy link
Contributor

Hello all! I will be working on the third point for this PR.

@RexYing I am looking at the GNNExplainer module in this example. If I understand this correctly, the explain_node method already provides a node_feat_mask for a specific node. What is not clear is if this mask the actual feature importance? If so, I can wrap this in a matplotlib bar plot.

I am planning to add the options for feature names and top N feature to plot. Is there anything else we should add for this specific point?

Thank you!

@rusty1s
Copy link
Member

rusty1s commented Nov 22, 2022

This sounds good. I think we can support this option for bothMaskType.common_attributes and MaskType.attributes (see #5967). For MaskType.attributes, we first need to reduce the feature mask from shape (N,F) to shape (F,).

@snknitin
Copy link

Does this include visualization of Heterogenous Graphs? How would one go about using the explainer module right now for HeteroData and for edge based prediction tasks?

@rusty1s
Copy link
Member

rusty1s commented Nov 22, 2022

It does not include visualizations of heterogeneous graphs. For heterogeneous graphs, we can later just leverage data.to_homogeneous() for visualization purposes.

@wsad1
Copy link
Member

wsad1 commented Nov 24, 2022

For hetero graphs it might be useful to include the node and edge types in the visualization. So we could consider building visualizations directly on heterogenous graphs.

@rusty1s
Copy link
Member

rusty1s commented Nov 24, 2022

Yes, these are available through data.to_homogeneous().

wsad1 added a commit that referenced this issue Dec 10, 2022
Work in progress for feat importance visualization for issue
[5631](#5631)

Co-authored-by: Jintang Li <cnljt@outlook.com>
Co-authored-by: Jinu Sunil <jinu.sunil@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@akash-vartak
Copy link
Member

Closing issue since tasks are complete and relevant PRs (#6235 and #6094) are linked in comments above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants