Skip to content

Conversation

moeinfinityx
Copy link
Owner

@moeinfinityx moeinfinityx commented Aug 10, 2022

Description

Add Heterogeneous Graph support for GNNExplainer

Checklist

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [$CATEGORY] (such as [NN], [Model], [Doc], [Feature]])
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage
  • Code is well-documented
  • To the best of my knowledge, examples are either not affected by this change,
    or have been fixed to be compatible with this change
  • Related issue is referred in this PR
  • If the PR is for a new model/paper, I've updated the example index here.

Changes

Added a new class HeteroGNNExplainer for Heterogeneous graph explanation.

The output of the model has been manually verified on MUTAG dataset. Unfortunately there's no ground truth for the explanation, so we cannot quantify the model's performance. Instead, we manually investigated the results and confirms that it aligns well with human intuition.

Link to the MUTAG Hetero GNNExplainer notebook

The code has also been verified on several datasets DGL officially provides, see this repo for details.

Inline documentation is added following the original style, and an example of using the module is included in the documentation.

@moeinfinityx moeinfinityx changed the title [Model] Gnnexplainer hetero [Model] Heterogeneous graph support for GNNExplainer Aug 10, 2022
@jikk
Copy link

jikk commented Aug 11, 2022

image

I saw the error from the notebook. Is it expected?

@jikk
Copy link

jikk commented Aug 11, 2022

@moeinfinityx can work on https://github.com/syssec-utd/dgl ?
I want to ask Muhyun review before we send this to DGL team.

@moeinfinityx
Copy link
Owner Author

image I saw the error from the notebook. Is it expected?

The warning appears when the code try to move tensors to CUDA device but there's no GPU available. Can be avoided by correctly pass the device parameter based on the availability of GPUs but not a big issue.

moeinfinityx added a commit that referenced this pull request Dec 12, 2022
* [Model] Heterogeneous graph support for GNNExplainer (#1)

* add HeteroGNNExplainer

* GNNExplainer for heterogeenous graph

* fix typo

* variable name cleanup

* added HeteroGNNExplainer test

* added doc indexing for HeteroGNNExplainer

* Update python/dgl/nn/pytorch/explain/gnnexplainer.py

Co-authored-by: Mufei Li <[email protected]>

* Update python/dgl/nn/pytorch/explain/gnnexplainer.py

Co-authored-by: Mufei Li <[email protected]>

* Update python/dgl/nn/pytorch/explain/gnnexplainer.py

Co-authored-by: Mufei Li <[email protected]>

* Update python/dgl/nn/pytorch/explain/gnnexplainer.py

Co-authored-by: Mufei Li <[email protected]>

* Update python/dgl/nn/pytorch/explain/gnnexplainer.py

Co-authored-by: Mufei Li <[email protected]>

* Update python/dgl/nn/pytorch/explain/gnnexplainer.py

Co-authored-by: Mufei Li <[email protected]>

* Update python/dgl/nn/pytorch/explain/gnnexplainer.py

Co-authored-by: Mufei Li <[email protected]>

* Update python/dgl/nn/pytorch/explain/gnnexplainer.py

Co-authored-by: Mufei Li <[email protected]>

* Update python/dgl/nn/pytorch/explain/gnnexplainer.py

Co-authored-by: Mufei Li <[email protected]>

* Update python/dgl/nn/pytorch/explain/gnnexplainer.py

Co-authored-by: Mufei Li <[email protected]>

* Update python/dgl/nn/pytorch/explain/gnnexplainer.py

Co-authored-by: Mufei Li <[email protected]>

* Update python/dgl/nn/pytorch/explain/gnnexplainer.py

Co-authored-by: Mufei Li <[email protected]>

* Update python/dgl/nn/pytorch/explain/gnnexplainer.py

Co-authored-by: Mufei Li <[email protected]>

* Update gnnexplainer.py

Change DGLHeteroGraph to DGLGraph, and specified parameter inputs

* Added ntype parameter to the explainer_node call

* responding to @mufeili's comment regarding restoring empty lines at appriopiate places to be consistent with existing practices

* responding to @mufeili's comment regarding restoring empty lines at appriopiate places that were missed in the last commit

* docstring comments added based on @mufeili suggestions

* indorporated @mufeili requested changes related to docstring model declaration.

* example model and test_nn.py added for explain_graphs

* explain_nodes fixed and fixed the way hetero num nodes and edges are handled

* white spaces removed

* lint issues fixed

* explain_graph model updated

* explain nodes model updated

* minor fixes related to gpu compatability

* cuda support added

* simplify WIP

* _init_masks for ennexplainer updated to match heterographs

* Update

* model simplified and docstring comments updated

* nits: docstring udpated

* lint check issues updated

* lint check updated

* soem formatting updated

* disabling int32 testing for GNNExplainer

* Update

Co-authored-by: Kangkook Jee <[email protected]>
Co-authored-by: ahadjawaid <[email protected]>
Co-authored-by: Mufei Li <[email protected]>
Co-authored-by: kxm180046 <[email protected]>
Co-authored-by: Kunal Mukherjee <[email protected]>
Co-authored-by: Ubuntu <[email protected]>
Co-authored-by: Ubuntu <[email protected]>
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.

2 participants