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

[WIP] variable num_neighbors for different hops & add self loop in the sampled subgraph #1

Closed
wants to merge 51 commits into from

Conversation

ZiyueHuang
Copy link

Description

Different hops might require different num_neighbors to be sampled (For example, in GraphSage, num_neigh = 25 for the first layer and num_neigh = 10 for the second layer). test_node_flow.py passed.

TODO: For GraphSage, self loop is needed in the sampled subgraph, which is required to implement an equivalent version in DGL.
image

Checklist

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [$CATEGORY] (such as [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 my best 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

Changes

examples/mxnet/gcn/gcn_ns.py Outdated Show resolved Hide resolved
examples/mxnet/gcn/gcn_ns.py Outdated Show resolved Hide resolved
examples/mxnet/gcn/gcn_ns.py Show resolved Hide resolved
@zheng-da
Copy link
Owner

zheng-da commented Feb 6, 2019

How do you add self-loop in the sampled subgraph?

@ZiyueHuang
Copy link
Author

I tried skip-connection (second-order proximity from Adaptive Sampling) in gcn_sc.py, which has amazing performance. On Cora, it achieves 80% test accuracy after ~30 epochs and finally ~84% test accuracy (if without skip-connection, it achieves 80% test accuracy after ~110 epochs and finally ~81% test accuracy). For neighbor sampling (num_neighbors=2), it stably and quickly achieves ~84% test accuracy (if without skip-connection, it achieves ~60% test accuracy unstably).

DGLBACKEND=mxnet python3 gcn_sc.py --dataset cora --num-neighbors NUM_NEIGHBORS  --batch-size 10000 --self-loop

DGLBACKEND=mxnet python3 gcn_ns.py --dataset cora --num-neighbors NUM_NEIGHBORS  --batch-size 10000 --self-loop

@zheng-da zheng-da force-pushed the fix_sampler1 branch 3 times, most recently from 854b67f to 32a525e Compare February 19, 2019 20:59
@ZiyueHuang ZiyueHuang closed this Feb 21, 2019
zheng-da pushed a commit that referenced this pull request Jun 29, 2020
…_edges (dmlc#1677)

* Fix (#1)

* Update

* Fix

* Fix

* Update

* Fix

* Fix

* Fix

* Fix

* Fixg

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Add test case

* Trigger CI (#2)

* Update

* Fix

* Fix

* Update

* Fix

* Fix

* Fix

* Fix

* Fixg

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Add test case

* test

* Fix (#3)

* Update

* Fix

* Fix

* Update

* Fix

* Fix

* Fix

* Fix

* Fixg

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Fix

* Add test case

* test

* Fix

* Fix

* Roll back

* Roll back

* CI

Co-authored-by: Minjie Wang <wmjlyjemaine@gmail.com>
zheng-da pushed a commit that referenced this pull request Aug 19, 2023
* [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 <mufeili1996@gmail.com>

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

Co-authored-by: Mufei Li <mufeili1996@gmail.com>

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

Co-authored-by: Mufei Li <mufeili1996@gmail.com>

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

Co-authored-by: Mufei Li <mufeili1996@gmail.com>

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

Co-authored-by: Mufei Li <mufeili1996@gmail.com>

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

Co-authored-by: Mufei Li <mufeili1996@gmail.com>

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

Co-authored-by: Mufei Li <mufeili1996@gmail.com>

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

Co-authored-by: Mufei Li <mufeili1996@gmail.com>

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

Co-authored-by: Mufei Li <mufeili1996@gmail.com>

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

Co-authored-by: Mufei Li <mufeili1996@gmail.com>

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

Co-authored-by: Mufei Li <mufeili1996@gmail.com>

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

Co-authored-by: Mufei Li <mufeili1996@gmail.com>

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

Co-authored-by: Mufei Li <mufeili1996@gmail.com>

* 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 <kangkook.jee@gmail.com>
Co-authored-by: ahadjawaid <94938815+ahadjawaid@users.noreply.github.com>
Co-authored-by: Mufei Li <mufeili1996@gmail.com>
Co-authored-by: kxm180046 <kxm180046@utdallas.edu>
Co-authored-by: Kunal Mukherjee <kunmukh@gmail.com>
Co-authored-by: Ubuntu <ubuntu@ip-172-31-9-26.ap-northeast-1.compute.internal>
Co-authored-by: Ubuntu <ubuntu@ip-172-31-36-188.ap-northeast-1.compute.internal>
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