Skip to content

Edge classification example #4831

Answered by rusty1s
Ishitori asked this question in Q&A
Jun 20, 2022 · 2 comments · 4 replies
Discussion options

You must be logged in to vote
  1. There exists operators that can incorporate both node and edge features (take a look at: https://pytorch-geometric.readthedocs.io/en/latest/notes/cheatsheet.html), e.g., TransformerConv.
  2. This is usually done by just converting node embeddings to edge-level representations:
    x = gnn(x, edge_index, edge_attr)
    x_src, x_dst = x[edge_index[0]], x[edge_index[1]]
    edge_feat = torch.cat([x_src, edge_attr, x_dst], dim=-1)
    out = classifier(edge_feat)
  3. We provide support for this via LinkNeighborLoader (needs installation from master)
  4. Yes :)

I sadly do not have an exact example of this use-case to share, but it should be pretty similar to https://github.com/pyg-team/pytorch_geometric/blob/master/exa…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@hahahaha90
Comment options

@rusty1s
Comment options

@sipie800
Comment options

Answer selected by Ishitori
Comment options

You must be logged in to vote
1 reply
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants