divelab / DIG

A library for graph deep learning research
https://diveintographs.readthedocs.io/
GNU General Public License v3.0
1.84k stars 281 forks source link

PGExplainer benchmark doesn't work on ba_shapes #131

Closed simoons95 closed 2 years ago

simoons95 commented 2 years ago

Hello,

Thank you for your library. I am doing research on graph explainability and it is really useful to have that kind of resource for comparison. However, I have a small problem with PGExplainer when running it on ba_shapes: some parameters are not defined, and when I add these parameters, there is a problem with a matrix multiplication about size. It looks like the code was written for the ba_community dataset only (and it works just fine for that specific dataset). Here is the command line I used:

python -m benchmarks.xgraph.train_gnns datasets=ba_shapes && python -m benchmarks.xgraph.pgexplainer_edges datasets=ba_shapes

And hereunder is the error message. What can I do to run PGExplainer on other datasets?

Have a nice day!


Error executing job with overrides: ['datasets=ba_shapes', 'explainers=pgexplainer', 'datasets.dataset_root=/workspace/external_src/DIG/benchmarks/xgraph/datasets', 'models.gnn_saving_dir=/workspace/external_src/DIG/benchmarks/xgraph/checkpoints', 'explainers.explainer_saving_dir=/workspace/external_src/DIG/benchmarks/xgraph/checkpoints', 'explainers.explanation_result_dir=/workspace/external_src/DIG/benchmarks/xgraph/results', 'record_filename=/workspace/external_src/DIG/benchmarks/xgraph/result_jsons']
Traceback (most recent call last):
  File "/workspace/external_src/DIG/benchmarks/xgraph/pgexplainer_edges.py", line 192, in pipeline
    pgexplainer.train_explanation_network(dataset)
  File "/workspace/external_src/DIG/dig/xgraph/method/pgexplainer.py", line 674, in train_explanation_network
    pred, edge_mask = self.explain(x, edge_index, emb, tmp, training=True, node_idx=new_node_index)
  File "/workspace/external_src/DIG/dig/xgraph/method/pgexplainer.py", line 588, in explain
    h = elayer(h)
  File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/container.py", line 141, in forward
    input = module(input)
  File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/linear.py", line 103, in forward
    return F.linear(input, self.weight, self.bias)
  File "/opt/conda/lib/python3.7/site-packages/torch/nn/functional.py", line 1848, in linear
    return torch._C._nn.linear(input, weight, bias)
RuntimeError: mat1 and mat2 shapes cannot be multiplied (3144x60 and 180x64)
Oceanusity commented 2 years ago

Hello, thank you for your issue. Would you mind checking the parameter of PGExplainer explain_graph is True or False for the node classification task BA-shapes?

Oceanusity commented 2 years ago

Thank you for your issue. I have updated the xgraph benchmark configuration and checkpoints. Welcome to post further information if your problem still exists.