Link Prediction explanation #4058
Replies: 4 comments 9 replies
-
I'm sorry to tell but we currently do not support explainability in link prediction tasks. We would need to bring both Pinging @RBendias here as well. |
Beta Was this translation helpful? Give feedback.
-
Hi, I just tried the The model needs to have a forward function: class Net(torch.nn.Module):
def __init__(self, in_channels, hidden_channels, out_channels):
super().__init__()
self.conv1 = GCNConv(in_channels, hidden_channels)
self.conv2 = GCNConv(hidden_channels, out_channels)
def encode(self, x, edge_index):
x = self.conv1(x, edge_index).relu()
return self.conv2(x, edge_index)
def decode(self, z, edge_label_index):
return (z[edge_label_index[0]] * z[edge_label_index[1]]).sum(dim=-1)
def decode_all(self, z):
prob_adj = z @ z.t()
return (prob_adj > 0).nonzero(as_tuple=False).t()
def forward(self, x, edge_index, edge_label_index):
z = self.encode(x, edge_index)
return self.decode(z, edge_label_index)
model = Net(...) Explore a particular edge by setting the node_idx argument to the index of the edge you want to examine. edge_index = 1
captum_model = to_captum(model, mask_type='node', node_idx=edge_index)
ig = IntegratedGradients(captum_model)
ig_attr_node = ig.attribute(test_data.x.unsqueeze(0),
additional_forward_args=(test_data.edge_index, test_data.edge_label_index),
internal_batch_size=1) |
Beta Was this translation helpful? Give feedback.
-
Hi, I've been trying to use This is the GNN model:
This is the graph structure (heterogeneous graph):
This is how I tried using
The error message:
Is this because the graph is heterogeneous (and it has different ways/functions to access the nodes/edges/indexes)? |
Beta Was this translation helpful? Give feedback.
-
Hi, on master we do support `to_captum` for hetero graphs now. Here you can
find instructions on how to use it:
https://github.com/pyg-team/pytorch_geometric/blob/master/torch_geometric/nn/models/captum.py#L326
.
Hi @rusty1s <https://github.com/rusty1s> Does pyg support the explainer for
… Heterograph until now?
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
are there any libraries or sources on explaining links. (for link prediction task)
I built a model that transforms node embeddings, then predicts links on those embeddings based on new node feat, edge feat, and edge attr;
is there a way I can find which node features or which edge feature are more important (can be for individual edges or for the complete model;
Regards
Beta Was this translation helpful? Give feedback.
All reactions