dmlc / dmlc/dgl

[Feature Request] Support binary classification in GNNExplainer

Open
#3,846 2 comments 0 reactions 1 assignee Claimed by @mufeili View on GitHub
feature request
Dominant language
Python
Stars
14.3k
Forks
3.1k
PR merge metrics
No merged PRs in 30d

Description

## 🚀 Feature
Support binary classifier GNNs(output dimension 1, i.e. a single score) in GNNExplainer

## Motivation
GNNExplainer in DGL assumes multi-class classification as the objective of the classifier it is explaining. So if we naively feed it a binary classifier it will assume all data points belong to a single class, and fail to explain any single target node correctly. Workarounds are possible for a user who is aware of this, but require the user to change the structure of the GNN model that she/he is trying to explain from output dimension 1, to 2. This is inconvenient for a user who knows what they are doing, but for the user who does not dig into the source code will cause wrong results.

## Alternatives

Workarounds by the user are a possible alternate, but less intuitive.

## The code segment in question
```
logits = self.model(graph=sg, feat=h,
eweight=edge_mask.sigmoid(), **kwargs)
log_probs = logits.log_softmax(dim=-1)
```
page: https://docs.dgl.ai/en/latest/_modules/dgl/nn/pytorch/explain/gnnexplainer.html

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.