Skip to content
Discussion options

You must be logged in to vote

A graph classification dataset contains only a single label per graph, while in node classification you have a label for each node. If you want to cast a graph classification dataset to a node classification one, I think it's reasonable to set each node label to the ground-truth label of the given class, e.g.:

def transform(data):
    data.y = data.y.repeat(data.num_nodes)
    return data

dataset = TUDataset(..., transform=transform)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jiaruHithub
Comment options

Answer selected by jiaruHithub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants