Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

running the code example in Tutorial for GNN Explainability; error: ModuleNotFoundError: No module named 'dig.xgraph.utils.compatibility' #169

Open
Oliver-0423 opened this issue Nov 22, 2022 · 11 comments
Labels
xgraph Interpretability of Graph Neural Networks

Comments

@Oliver-0423
Copy link

No description provided.

@Oliver-0423
Copy link
Author

torch 1.10.1
torch_geometric 2.1.0
dig 0.1.2

@YANI-ALT
Copy link

Hello,

Thank you for such a wonderful library !
I too am facing the same issue when trying to import from dig.xgraph.utils.compatibility
Any way to fix this ?

@Oliver-0423
Copy link
Author

another bug:
running:
result = find_closest_node_result(explanation_results[prediction], max_nodes=max_nodes)

error:
AttributeError: 'dict' object has no attribute 'coalition'

Has anyone run this tutorial successfully?

@Oliver-0423
Copy link
Author

@YANI-ALT download from git , don't use pip install dive-into-graphs,

@Oliver-0423
Copy link
Author

@YANI-ALT better don't use windows, This project is very Windows unfriendly

@yhliu2022
Copy link

I tried to install through git:
git clone https://github.com/divelab/DIG.git
cd DIG
pip install .

but got the following error:

Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [10 lines of output]
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "C:\Users\yhl20\AppData\Local\Temp\pip-install-69uiodic\pyscf_b8c62cba3e4e4704af415c5acfeb55a5\setup.py", line 206, in
blas_path_guess = [search_lib_path('lib'+x+so_ext, blas_lib_dir)
File "C:\Users\yhl20\AppData\Local\Temp\pip-install-69uiodic\pyscf_b8c62cba3e4e4704af415c5acfeb55a5\setup.py", line 206, in
blas_path_guess = [search_lib_path('lib'+x+so_ext, blas_lib_dir)
File "C:\Users\yhl20\AppData\Local\Temp\pip-install-69uiodic\pyscf_b8c62cba3e4e4704af415c5acfeb55a5\setup.py", line 148, in search_lib_path
paths = os.environ.get(LD_LIBRARY_PATH, '').split(os.pathsep)
NameError: name 'LD_LIBRARY_PATH' is not defined
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

@timondesch
Copy link

I had the same error importing compatible_state_dict from dig.xgraph.utils.compatibility. It seems to be a compatibility issue, and I fixed it by downgrading my python version to 3.7 (from 3.10.8).

However, I am still having the same error as @Oliver-0423 describes:

another bug: running: result = find_closest_node_result(explanation_results[prediction], max_nodes=max_nodes)

error: AttributeError: 'dict' object has no attribute 'coalition'

It seems to me that there are a few issues with this tutorial, starting with the fact that the version on readthedocs is not up to date with the latest one on github.

From the Github version, here are the problems I noted:

  • Missing import statement for Data (from torch_geometric.data)
  • The explanation_results variable needs to be made into a MCTS tree before being fed to find_closest_node_result
  • The links for the SubgraphX and MCTS classes are not redirecting properly
  • It seems like the visualization function does not take (anymore?) the prediction as an input parameter, thus we need to remove it and replace our newly MCTS'ed explanation_results by explanation_results[prediction]
  • For the quantitative explanation, the explanation_results again have to be MCTS'ed

Additionally for the quantitative explanation part, the related_preds consist of {'masked', 'maskout', 'origin', 'sparsity'}, and I'm not sure how the fidelity metric is derived from those in the tutorial. I get the same value for the sparsity, but calculating the fidelity+ or fidelity- metrics (presented in https://arxiv.org/abs/2012.15445) gives me very different results from the .1384 of the tutorial.

I'm new to the library and unsure about my conclusions, would it be possible to have a confirmation from @Oceanusity, @CM-BF or maybe @mengliu1998 (sorry for the ping) ? If confirmed, I can fix those issues and submit a PR.

@frankwxu
Copy link

same problem.

@mengliu1998 mengliu1998 added the xgraph Interpretability of Graph Neural Networks label Feb 14, 2023
@CM-BF
Copy link
Collaborator

CM-BF commented Feb 20, 2023

This compatibility module is only available on dig-stable branch. For different dig, you may refer to the different tutorials. If you are unsure about the version you are using, I would recommend using the examples in <Project_root>/examples/xgraph/ to start. The examples and the code are one-to-one corresponding.

@citceae
Copy link

citceae commented Feb 20, 2024

another bug: running: result = find_closest_node_result(explanation_results[prediction], max_nodes=max_nodes)

error: AttributeError: 'dict' object has no attribute 'coalition'

Has anyone run this tutorial successfully?

It can be repaired by adding the following code at the beginning of the function find_closest_node_result in .../dig/xgraph/method/subgraphx.py

if isinstance(results[0], dict):
        results = [MCTSNode(device='cpu').load_info(node_info) for node_info in results]

It looks like the example code mixes list of MCTSNode and list of dict.

@ZhongLIFR
Copy link

I also had the problem
AttributeError: 'dict' object has no attribute 'coalition'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
xgraph Interpretability of Graph Neural Networks
Projects
None yet
Development

No branches or pull requests

9 participants