DIG icon indicating copy to clipboard operation
DIG copied to clipboard

the methods in xgraph can only explain model in dig.xgraph.models

Open Oliver-0423 opened this issue 3 years ago • 4 comments

the methods in xgraph can only explain model in dig.xgraph.models,i try to use it to explain my model which is built by PYG, get the error:

KeyError: 'explain_message'

this is my model:

from torch_geometric.nn import GCNConv
class Net(torch.nn.Module):
    def __init__(self):
        super().__init__()
        self.conv1 = GCNConv(dataset.num_features, 16, normalize=False)
        self.conv2 = GCNConv(16, dataset.num_classes, normalize=False)
    def forward(self, x, edge_index):
        x = F.relu(self.conv1(x, edge_index))
        x = F.dropout(x, training=self.training)
        x = self.conv2(x, edge_index)
        return F.log_softmax(x, dim=1)

Oliver-0423 avatar Feb 03 '23 12:02 Oliver-0423

pyg version 2.1.0, dig version 1.0.0 torch 1.13.0

Oliver-0423 avatar Feb 03 '23 12:02 Oliver-0423

Please refer to the model defined in https://github.com/divelab/DIG/blob/dig-stable/dig/xgraph/models/models.py

Oceanusity avatar Feb 16 '23 17:02 Oceanusity

@Oceanusity So we can only explain models defined in the models.py file? Can we explain models that are built as the combinations from models from the file? For example, if I define a model which combines GCN_3l and GCN_2l, we the explaining methods work as well?

chriswu99aaa avatar Mar 08 '23 20:03 chriswu99aaa

I think so, if the new GNN is the subclass of GNNBasic.

Oceanusity avatar Mar 08 '23 20:03 Oceanusity