openhgnn.trainerflow.LinkPrediction

class LinkPrediction(args)[source]

Link Prediction trainer flows. Here is a tutorial teach you how to train a GNN for link prediction <https://docs.dgl.ai/en/latest/tutorials/blitz/4_link_predict.html>_.

When training, you will need to remove the edges in the test set from the original graph. DGL recommends you to treat the pairs of nodes as another graph, since you can describe a pair of nodes with an edge. In link prediction, you will have a positive graph consisting of all the positive examples as edges, and a negative graph consisting of all the negative examples. The positive graph and the negative graph will contain the same set of nodes as the original graph. This makes it easier to pass node features among multiple graphs for computation. As you will see later, you can directly feed the node representations computed on the entire graph to the positive and the negative graphs for computing pair-wise scores.