divelab / DIG

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

Cache is not working with SubgraphX and GNNExplainer #154

Closed simoons95 closed 1 year ago

simoons95 commented 1 year ago

Hello,

I try to use the dig library, but I am unable to use the call function of SubgraphX. The error is that it saves a list of results, which is turned into a list of list of MCTSNode, which in turn is used in find_closest_node_result as if it was a list of MCTSNode, with the x.coalition on line 27 of /DIG/dig/xgraph/method/subgraphx.py returning an error as x is a list. I also have a cache problem with GNNExplainer, with the edge_masks kwarg being used as the name of the cache as well as when calling the self.eval_related_pred function. I think you should simply remove edge_masks from the kwargs once it has been used.

Oceanusity commented 1 year ago

Hello, thank you for your issue.

For the GNNExplainer, I think you can take None to replace the edge_masks as the input of eval_related_pred . Since the parameter related_preds is the key for calculating metrics, it's okay not to feed the explanation mask to eval_related_pred.

This is the same situation for the SubgraphX, you can just save and use the related_pred value.