tkipf / gcn

Implementation of Graph Convolutional Networks in TensorFlow
MIT License
7.08k stars 2k forks source link

How to use GCN to generate embeddings to graph nodes #85

Open mro15 opened 5 years ago

mro15 commented 5 years ago

Hello! First of all thanks for this amazing work!

Sorry if this is a dumb question. I want to use GCN for text classification, in my datasets all the documents are labeled. So, I will transform the dataset in graph format, and give the adjacency matrix as input for GCN. My question is if I can generate embeddings (features) for each node of the graph (words) to test in different classifiers.

Thanks

tkipf commented 5 years ago

If you independently would like to learn embeddings of nodes and later try different classifiers on top of them, try GAEs: https://github.com/tkipf/gae -- this model can be used for unsupervised learning as well as link prediction. The embeddings you obtain after training can be fed into a classifier right away and usually give (close to) state-of-the-art performance.

On Mon, Feb 11, 2019 at 12:14 PM Marcela Ribeiro de Oliveira < notifications@github.com> wrote:

Hello! First of all thanks for this amazing work!

Sorry if this is a dumb question. I want to use GCN for text classification, in my datasets all the documents are labeled. So, I will transform the dataset in graph format, and give the adjacency matrix as input for GCN. My question is if I can generate embeddings (features) for each node of the graph (words) to test in different classifiers.

Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tkipf/gcn/issues/85, or mute the thread https://github.com/notifications/unsubscribe-auth/AHAcYB1nZFDL2_UMd6tY6-P08fXJ-hQbks5vMVCcgaJpZM4az-C_ .

mro15 commented 5 years ago

Thanks for your response! In my tests I want to generate the graph representation (features for each labeled node), like classical CNN. My propose is to test different graphs for the same document set and see how graph work better in GCN to represent this document set. In this work TextGCN, the authors use GCN to generate node embeddings, I want to do the same with my graphs but instead of softmax classifier I want to test some others. Is there any adjust in GCN code that I have to do to get the node embeddings?

Thanks again for your response!

tkipf commented 5 years ago

You can access intermediate activations (node embeddings) via model.activations -- have a look at models.py for more details.

On Thu, Mar 14, 2019 at 6:45 PM Marcela Ribeiro de Oliveira < notifications@github.com> wrote:

Thanks for your response! In my tests I want to generate the graph representation (features for each labeled node), like classical CNN. My propose is to test different graphs for the same document set and see how graph work better in GCN to represent this document set. In this work TextGCN https://arxiv.org/pdf/1809.05679.pdf, the authors use GCN to generate node embeddings, I want to do the same with my graphs but instead of softmax classifier I want to test some others. Is there any adjust in GCN code that I have to do to get the node embeddings?

Thanks again for your response!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tkipf/gcn/issues/85#issuecomment-472984226, or mute the thread https://github.com/notifications/unsubscribe-auth/AHAcYKkhqIUtzG8NBAssx4ATyjsZnYLdks5vWoqkgaJpZM4az-C_ .