Negative Sampling in hetero-RGCN for Link Prediction

Hi, very helpful library!

I’m a newbie, and trying to use hetero-RGCN (implemented by dgl.nn.pytorch.conv.RelGraphConv) to do the link prediction task.

I load my custom data into DGLHeteroGraph with several node types and edge types, and would like to predict the probability of existence of certain one edge types. To train the model, I need edge sampler. Is there a negative sampler API that can manipulate DGLHeteroGraph directly? Would you mind giving an example?

I noticed dgl.data.LinkPredDataLoader from link seems solves the problem. Is that a part of features in DGL v0.5?

Thank you very much! :grinning:

You can look at code here:

As you are only doing neg sampling of only one edge type. You can simply the code a lot.