Link prediction questions

Considering tutorial reference and my code, how should I specify the graph_sampler for the Dataloader to only consider sampling non-self loop edges, while always keeping self-loops for every node output from dataloader.

is training with supervision edges helpful in link prediction task as shown here and here, I haven’t seen such in any dgl examples.
So, a set of supervision edges are those used to predict the loss and these are the only edges used for backpropagation in training in transductive setting, but what are the supervision edges in inductive val/test split for? those are the edges for accuracy calculation in those splits?

How will the graph_sampler look like for transductive link prediction split with supervision edges for train/val/test? a code example would be helpful.

Has anyone seen time-based split in any papers or implementations, where train edges are included in val graph and train+val edges in test graph, for transductive link prediction as in above reference?

Thanks!

Sorry for the late reply. To only consider sampling non-self loops, you can pass a graph without self-loops in constructing the data loader. To keep self-loops for each mini-batch, you need to implement a custom sampler.

but what are the supervision edges in inductive val/test split for? those are the edges for accuracy calculation in those splits?

I think so.

How will the graph_sampler look like for transductive link prediction split with supervision edges for train/val/test? a code example would be helpful.

The tutorial does not distinguish message edges from supervision edges. Should there be a distinction, I imagine a flow like below will make more sense.

for batch_edges in supervision_edges:
     get end_nodes of the batch_edges
     sample blocks/subgraph from the end_nodes
     GNN computation
     loss computation
     backward

@BarclayII See if you have better suggestions.

According to the slides, “supervision edges” are those used to compute the objectives, while “message edges” are those that are not “supervision edges”. This is controlled with the exclude argument of dgl.dataloading.as_edge_prediction_sampler (or dgl.dataloading.EdgeDataLoader). You can look at the documentation for details, but here’s a summary:

  • Supervision edges are always the edges sampled in the minibatch. Our documentation refer to them as “seed edges”.
  • If exclude is either 'self', 'reverse_types' or 'reverse_id', then the message edges will be those excluding the supervision edges, as well as their reverse edges if exclude is reverse_types or reverse_id.
  • If exclude is a tensor or a dictionary of tensors, then the message edges will be all edges other than the edges you give it. This will be useful for inductive validation and testing, since you can pass the graph with train/validation/test edges to the DataLoader, and pass in the validation and test edges to the exclude argument.
  • You can also write your own rules of how to find the message edges by giving exclude a function.
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.