Comments (7)
if edge_vmax is None:
edge_vmax = statistics.median_high(
[d for (u, v, d) in Gc.edges(data="weight", default=1)]
)
min_color = min([d for (u, v, d) in Gc.edges(data="weight", default=1)])
# color range: gray to black
if type(edge_vmax) is torch.Tensor:
edge_vmax=edge_vmax.item()
edge_vmin = 2 * min_color - edge_vmax
nx.draw(
Gc,
pos=pos_layout,
with_labels=False,
font_size=4,
labels=feat_labels,
node_color=node_colors,
vmin=0,
vmax=vmax,
cmap=cmap,
edge_color=edge_colors,
edge_cmap=plt.get_cmap("Greys"),
edge_vmin=edge_vmin,
edge_vmax=edge_vmax,
width=1.0,
node_size=50,
alpha=0.8,
)
from gnn-model-explainer.
utils/io_utils.py
def denoise_graph(adj, node_idx, feat=None, label=None, threshold=None, threshold_num=None, max_component=True):
if type(adj) is torch.Tensor:
adj=adj.detach().numpy()
num_nodes = adj.shape[-1]
G = nx.Graph()
G.add_nodes_from(range(num_nodes))
G.nodes[node_idx]["self"] = 1
...
from gnn-model-explainer.
- because gradient values in adjacency matrix are very incremental, this often occurs "empty edge" error whenever calling "log_adj_grad(...)" in explain.py, line871. So i would recommend to set its threshold from 0.0003 to 0.0000
explainer/explain.py (line 916)
if self.graph_mode:
print("GRAPH model")
G = io_utils.denoise_graph(
adj_grad,
node_idx,
feat=self.x[0],
threshold=0.0000, # threshold_num=20,
max_component=True,
)
from gnn-model-explainer.
I also met with this same error when running explanation on MUTAG:
python -W ignore explainer_main.py --bmname=MUTAG --graph-mode
ValueError: Invalid RGBA argument: tensor(1., dtype=torch.float64)
I tried the solution proposed by sengjun45 that change the threshold to 0.0000, but it does not work for me. Do you possibly have any ideas on this? @RexYing
Thanks very much in advance!
from gnn-model-explainer.
@HennyJie Do you figure out how to deal with the error:
ValueError: Invalid RGBA argument: tensor(1., dtype=torch.float64)
I also get this error, when I try to run GNNExplainer on MUTAG
from gnn-model-explainer.
Any update on this?
from gnn-model-explainer.
I was able to resolve this issue by just inserting:
if torch.is_tensor(edge_colors[0]):
print(edge_colors)
edge_colors = [x.cpu().detach().numpy().tolist() for x in edge_colors]
print("changed edge color to list type")
print(edge_colors)
right before line 330 in utils/io_utils.py
. I am not sure if this a proper solution as I am only converting the tensor type elements to list type.
from gnn-model-explainer.
Related Issues (20)
- Broken link to Observable in README.md
- The requirements.txt should be changed to make Installation work. HOT 1
- Where is the dataset and what kind of dataset am I supposed to use inorder to train? HOT 1
- While training on Tox21 data: "NameError: name 'io_utils' is not defined" HOT 1
- node_idx_new = sum(neighbors_adj_row[:node_idx])--is it possible the way that node_idx_new is generated may lead to duplicate index?
- Question on Explainer Visualization
- Question about link prediction HOT 3
- Question about run bmname=MUTA
- Generating different explanations' subgraphs from the same trained model by using PyG GNNExplainer HOT 1
- Explain Graph Nets models
- Pytorch Geometric training for synthetic data HOT 1
- Frozen Synthetic Dataset
- Accuracy HOT 1
- Reproduction of multi-instance explanations and prototypes
- Doubt: GNNExplainer on Deep GCNN on Graph Classification Tasks HOT 2
- Use this model explain the graph-level GNN model? HOT 1
- Apply to hetero GNN?
- Observable notebook does not exist
- Question about the loss
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gnn-model-explainer.