`GNNExplainer` for link prediction
See original GitHub issue❓ Questions & Help
Hi @rusty1s,
I wrote a GNN model by pytorch geometric to do the link prediction which refers to this example. The forward part of the model is showed below. I tried to use GNNExplainer to explain my model but got an error forward() got an unexpected keyword argument 'edge_index'
. Since my forward doesn’t directly use edge_index
, this might cause the issue. Is it possible that I can have an example to use GNNExplainer for link prediction? Or some instructions to modify the GNNExplainer for my model? Thank you!
def forward(self, x, adjs, link, n_id):
for i, (edge_index, _, size) in enumerate(adjs):
x_target = x[:size[1]] # Target nodes are always placed first.
x = self.convs[i]((x, x_target), edge_index)
if i != self.num_layers - 1:
x = F.relu(x)
x = F.dropout(x, p=self.dropout_p, training=self.training)
x = x[[list(np.where(n_id.numpy()==i.numpy())[0])[0] for i in link[:,0]]] * x[[list(np.where(n_id.numpy()==i.numpy())[0])[0] for i in link[:,1]]]
x = torch.sigmoid(self.lin(x)).squeeze(1)
return x
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:18 (9 by maintainers)
Top Results From Across the Web
`GNNExplainer` for link prediction · Issue #1728 - GitHub
I wrote a GNN model by pytorch geometric to do the link prediction which refers to this example. The forward part of the...
Read more >GNN-Explainer - SNAP: Stanford
GNN-Explainer is a general tool for explaining predictions made by graph ... Node classification; Graph classification; Link prediction.
Read more >GNNExplainer: Generating Explanations ... - Papers With Code
We formulate GNNExplainer as an optimization task that maximizes the mutual information between a GNN's prediction and distribution of possible subgraph ...
Read more >SEAL Link Prediction, Explained - Towards Data Science
Link prediction is a really hot topic of research in the graph field. For example, given a social network below with different nodes...
Read more >GNNExplainer: Generating Explanations for Graph Neural ...
The approach is model-agnostic and can explain predictions of any GNN on any machine learning task for graphs, including node classification, link prediction, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would also like to put in a vote for adding link-prediction functionality to the GNNExplainer class!
Noted 😃 Let’s see what we can do!