pyg-team / pytorch_geometric

Graph Neural Network Library for PyTorch
https://pyg.org
MIT License
20.96k stars 3.61k forks source link

Implementation for PGExplainer (GNN interpretation method)? #2069

Open shalinkpatel opened 3 years ago

shalinkpatel commented 3 years ago

🚀 Feature

GNN interpretation is becoming more and more important and would be pretty great to have in this framework. GNNExplainer is good but recently a new interpretation model emerged in NuerIPS 2020 called PGExplainer. It has much better performance and is parametrized by the nodes meaning it's a broader method than GNNExplainer. The user just needs to train the explainer once for the whole graph and can produce an explanation for any given node without the need for any significant overhead. The paper is linked here https://arxiv.org/pdf/2011.04573

rusty1s commented 3 years ago

Yes, that is something which I would love to add to PyG. Please let me know if you would like to contribute.

shalinkpatel commented 3 years ago

Sure, though I am not quite sure how to get started. If you could point me in the right direction i can take a stab at it :). The academic code for the paper can be found at https://github.com/flyingdoog/PGExplainer. (Note I'm not connected to the paper at all, I just think it would be cool to integrate in this package)

wsad1 commented 3 years ago

@shalinkpatel, Firstly thanks for sharing the paper. I had some thoughts on the implementation.

  1. the pg explainer module can be built, working off gnn explainer code
  2. it modifies __edge_mask__ and a similar thing could be done for pgexplainer.
  3. further a new loss module will need to be implemented.

I'd be happy to collaborate with you on this.

shalinkpatel commented 3 years ago

@wsad1 Thanks for the thoughts. I actually already started work on the issue recently. It follows the basic steps you just mentioned above. It runs and trains without error so far. Currently, I am just in the process of debugging so it shouldn't be too long :). Thanks for the offer though!

wsad1 commented 3 years ago

@shalinkpatel . Are still you working on this.

shalinkpatel commented 3 years ago

@wsad1 Unfortunately I have had to stop working on this due to other time commitments. I actually got it to work (somewhat) in this forked repo: https://github.com/shalinkpatel/pytorch_geometric. The main issue is that the budget and connectivity constraint are not implemented yet and as such the method does not work well at all. Please feel free to pick up from where I left off or however you would like to. I will have more time in a month and will probably revisit then.

wsad1 commented 3 years ago

Thanks, i'll check it out this weekend.