Is there a complete example of the Unsupervised GraphSage with its loss formulation?
We don't have an example for this yet. However, implementing it should be straightforward via torch_geometric.utils.negative_sampling.
Is it something thats planned to be added? If yes, I could work on it.
It would be awesome if you would contribute that:)
@Sharad24 I think it could be a lot similar to https://github.com/rusty1s/pytorch_geometric/blob/master/examples/autoencoder.py , but using SAGEConv and NeighborSampler
@rusty1s thoughts?
That's true. It's a combination of examples/reddit.py and examples/autoencoder.py. One can start with the reddit.py example and replace its loss formulation. Note that you need two forward passes now, one for positive edges and one for negative ones.
@Sharad24 I think it could be a lot similar to https://github.com/rusty1s/pytorch_geometric/blob/master/examples/autoencoder.py , but using
SAGEConvandNeighborSampler@rusty1s thoughts?
Yup, thanks for the info and references!
That's true. It's a combination of
examples/reddit.pyandexamples/autoencoder.py. One can start with thereddit.pyexample and replace its loss formulation. Note that you need two forward passes now, one for positive edges and one for negative ones.
Thanks @rusty1s
@rusty1s so I did an implementation of this using examples/reddit.py and examples/autoencoder.py https://gist.github.com/arunavsk/7a4091ccddcbfa6eb31c35c5ce7fe462
I used recon_loss() from nn.GAE which I guess in turn uses the positive edges and utils.negative_sampling() to calculate the total loss.
Cool, feel free to send a PR :)
Most helpful comment
Yup, thanks for the info and references!
Thanks @rusty1s