Pytorch_geometric: Unsupervised GraphSage

Created on 12 Jul 2020  ·  8Comments  ·  Source: rusty1s/pytorch_geometric

❓ Questions & Help

Is there a complete example of the Unsupervised GraphSage with its loss formulation?

Most helpful comment

@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?

Yup, thanks for the info and references!

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.

Thanks @rusty1s

All 8 comments

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 SAGEConv and NeighborSampler

@rusty1s thoughts?

Yup, thanks for the info and references!

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.

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 :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zhangfuyang picture zhangfuyang  ·  4Comments

WeiyiLee6666 picture WeiyiLee6666  ·  4Comments

ChrisBobotsis picture ChrisBobotsis  ·  3Comments

SaschaStenger picture SaschaStenger  ·  4Comments

zc-alexfan picture zc-alexfan  ·  3Comments