Skip to content

edge_mask=gnnexplainer_related_preds[1][prediction], NameError: name 'prediction' is not defined #240

Description

@scottdd204

See tutorials/KDD2022/xgraph_code_tutorial.ipynb

gnnexplainer_related_preds =
gnnexplainer(data.x, data.edge_index, sparsity=sparsity, num_classes=num_classes, node_idx=node_idx)
ax, G = gnnexplainer.visualize_graph(node_idx=node_idx,
edge_index=data.edge_index,
edge_mask=gnnexplainer_related_preds[1][prediction],
y=data.y)

And therefore there is no example of visualisation for GNNExplainer.

Activity

  1. changed the title [-]Traceback (most recent call last): File "/home/scott/DIGGNNEXPLAINER.py", line 83, in <module> edge_mask=gnnexplainer_related_preds[1][prediction], NameError: name 'prediction' is not defined[/-] [+] edge_mask=gnnexplainer_related_preds[1][prediction], NameError: name 'prediction' is not defined[/+] on Feb 9, 2024
  2. Oceanusity commented on Feb 9, 2024

    @Oceanusity
    Collaborator

    Hi, the prediction results is missed, and should add codes
    node_idx = node_indices[20], logits = model(data.x, data.edge_index) and
    prediction = logits[node_idx].argmax(-1).item() .

    Thanks for pointing it out.

  3. Oceanusity commented on Feb 9, 2024

    @Oceanusity
    Collaborator

    Or you can run the visualization for subgraphx first, and then you will have the prediction variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions