Link prediction on multiple graph with custom negative edge sampling #6151
-
Hi all, I have recently been migrating to Pytorch Geometric from another library and am curious about how I should handle the following use case. I have multiple separate graphs and want to train a link prediction model. In PyTorch geometric, what is the best way of managing these graphs for my task? I was looking at creating my custom dataset class and using diagonal batching. Is this the best way? Furthermore, is there any prebuilt functionality to guarantee the sampling-of-negative-edges described above? Thank you for any input you may give me, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I think you can use the normal |
Beta Was this translation helpful? Give feedback.
I think you can use the normal
DataLoader
for this to batch your multiple graphs together, but just need to make sure to not sample negative links between two different graphs. There is autils.batched_negative_sampling
functionality which you can call inside your training loop to achieve this. Hope this helps!