wup017
wup017

Reputation: 31

Link prediction using edge features/attributes in PyTorch geometric

I have a custom homogeneous graph dataset with undirected edges, where each edge has 22 features and each node has 2 features. I would like to perform link prediction on this dataset using the edge features. I attempted to do so using a PyTorch geometric example, which demonstrates link prediction based on node features.

How can I use edge features for link prediction instead of node features, as shown in the example?

A similar question has been asked before, but it didn't receive much attention.

Upvotes: 3

Views: 303

Answers (1)

daqh
daqh

Reputation: 52

Usually, link prediction algorithms that leverages node features to perform link prediction, combines them in order to obtain an edge representation.

For example, combining the features of nodes a and b, we will get the (a, b) edge representation... At this point we can use something like a linear layer to transform this representation into a score s((a, b)) that describes the likelihood of the edge to appear in the graph.

For your specific case, you can proceed in two ways:

  1. Use a neural network that exploits both node and edge features to perform link prediction.
  2. Use a simpler neural network that uses only the edge features, such as some combination of Linear layers.

However, the training of a network for a link prediction task usually requires the use of negative edges (connection that are less likely to appear in the network), and in your case, for a fair training, you should be able to compute edge features also for negative edges.

Upvotes: 0

Related Questions