Hi, I would like to implement unsupervised GraphSAGE in the GraphSAGE paper. Is there a function in PyG for sampling the negative node indices? torch_geometric.utils.negative_sampling is used to sample edges but not nodes.
Hi and thanks for your interest! We do not have an example for this yet, but you can follow this issue to track its progress.
@rusty1s I have implemented unsupervised GraphSAGE, using torch_cluster.randow_walk to sample neighbors and NeighborSamplerto generate mini-batch, and another NeighborSampler to randomly shuffle the nodes for negative sampling.
Could you have a look at the code below? It would be great that it could be added to the examples.
https://gist.github.com/yuanx749/de835f92f4e44a9cf825a5638968e7e5
Hey @yuanx749 - I have a simpler version of this https://gist.github.com/arunavsk/7a4091ccddcbfa6eb31c35c5ce7fe462
Both versions look fine to me. We can definitely integrate it into the PyG examples. Feel free to send a PR.
Most helpful comment
Hey @yuanx749 - I have a simpler version of this https://gist.github.com/arunavsk/7a4091ccddcbfa6eb31c35c5ce7fe462