divelab / DIG

A library for graph deep learning research
https://diveintographs.readthedocs.io/
GNU General Public License v3.0
1.84k stars 280 forks source link

Self-Supervised GNNs #83

Closed abrahami closed 2 years ago

abrahami commented 2 years ago

hi! I am trying to use the implementation of the self-supervised GNNs (e.g., InfoGraph). However, the example provided is using a graph dataset that is labeled and actually evaluate the model by using sklearn supervised evaluation process. I am looking for an end-to-end example of applying the algorithm in an unsupervised way and get an embeddings representation per graph.

thanks a lot!

ycremar commented 2 years ago

Hi @abrahami ,

Thank you for your question. Following the example, once the model is trained, you can obtain the embedding of any graph data by embed = encoder(data).

For more flexibility, you can manually train the model without downstream evaluation by

infograph.train(encoder, pretrain_dataloader, optimizer, num_epoches)

and then embed = encoder(data).

Please feel free to reopen the issue if you have any further questions!

abrahami commented 2 years ago

thank you @ycremar! Got it