gae icon indicating copy to clipboard operation
gae copied to clipboard

About weighted graph

Open johnqoe opened this issue 6 years ago • 6 comments

Hi Thomas! Thanks for your really great work! I try to use my weighted graph to train this model. But I don't know if GAE model can be applied to the weighted graph, If it works, could you give some guidance?

johnqoe avatar Mar 28 '19 15:03 johnqoe

In principle, using a weighted graph as an input should work without modifications to the framework. In order to use a binary classification target for predicting links, you would presumably have to threshold the weights in your adjacency matrix first to determine which edges should be used as positive or negative examples. The GCN encoder, however, can take weighted graphs as input.

PS: Thanks for the nice words:)

On Thu, Mar 28, 2019 at 6:01 PM johnqoe [email protected] wrote:

Hi Thomas! Thanks for your really great work! I try to use my weighted graph to train this model. But I don't know if GAE model can be applied to the weighted graph, If it works, could you give some guidance?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tkipf/gae/issues/28, or mute the thread https://github.com/notifications/unsubscribe-auth/AHAcYPSQbBg_i92rZsAyLWJfmJ37r-Jcks5vbNsZgaJpZM4cQZ0h .

tkipf avatar Mar 28 '19 19:03 tkipf

Thans for your reply and guidance. I still have some questions and would like to trouble you for advice.

objective: The graph in my experiment is a fully connected graph, each edge has a non-zero weight, and each node has two attributes (values greater than 1), I want to get the node representation(embeddings) based on the GAE model,and further do node clustering.

questions: At the moment, I have finished loading the data, but I am having trouble selecting the edge as a negative sample. I don't know how to select the edge or its weight as a negative sample. As you suggested above, Is it necessary to set a threshold for the weight of the edge? An edge larger than the threshold is used as a positive sample, instead, an edge smaller than the threshold is used as a negative sample. Could I make out in this way?

I hope that you can give some advice and guidance and look forward to your reply.

The text file in the attachment stores the adjacency matrix used in my experiment. adj.txt

johnqoe avatar Mar 29 '19 07:03 johnqoe

Yes, picking a threshold on the edge weights and selecting positive/negative samples based on this threshold is the easiest way to adapt your data to fit with the GAE framework. Of course you could also directly do regression on the continuous edge weights instead of a classification target, but this will be O(N^2) where N is the number of nodes in your graph. Sparsification helps reduce the computational cost in this case, but of course it might affect the quality of your results. Hope this helps.

On Fri, Mar 29, 2019 at 8:47 AM johnqoe [email protected] wrote:

Thans for your reply and guidance. I still have some questions and would like to trouble you for advice.

objective: The graph in my experiment is a fully connected graph, each edge has a non-zero weight, and each node has two attributes (values greater than 1), I want to get the node representation(embeddings) based on the GAE model,and further do node clustering.

questions: At the moment, I have finished loading the data, but I am having trouble selecting the edge as a negative sample. I don't know how to select the edge or its weight as a negative sample. As you suggested above, Is it necessary to set a threshold for the weight of the edge? An edge larger than the threshold is used as a positive sample, instead, an edge smaller than the threshold is used as a negative sample. Could I make out in this way?

I hope that you can give some advice and guidance and look forward to your reply.

The text file in the attachment stores the adjacency matrix used in my experiment. adj.txt https://github.com/tkipf/gae/files/3021578/adj.txt

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tkipf/gae/issues/28#issuecomment-477901848, or mute the thread https://github.com/notifications/unsubscribe-auth/AHAcYIHuDpaeqI6HNGbaRL-8J0M_LDuIks5vbcUggaJpZM4cQZ0h .

tkipf avatar Mar 29 '19 09:03 tkipf

That would really help me a lot. I'm very grateful.

johnqoe avatar Mar 29 '19 10:03 johnqoe

Hello, I am also using the GAE model on adjacency matrix data with continuous positive weights. I ran into a problem while training the network to create reconstructions of the original adjacency matrix. For some reason, despite changing the activation function of the InnerProductDecoder from sigmoid to relu, I get reconstructions that contain only binary values of 0 or 1 instead of continuous weights.

Does the current framework support reconstructions of continuously weighted adjacency matrix? Thank you so much for your time.

sonoftherock avatar May 21 '19 19:05 sonoftherock

Yes, I recommend using a sigmoid activation function and mean-squared error as loss function in this case.

On Tue, May 21, 2019 at 12:41 PM Trevor Shim [email protected] wrote:

Hello, I am also using the GAE model on adjacency matrix data with continuous positive weights. I ran into a problem while training the network to create reconstructions of the original adjacency matrix. For some reason, despite changing the activation function of the InnerProductDecoder from sigmoid to relu, I get reconstructions that contain only binary values of 0 or 1 instead of continuous weights.

Does the current framework support reconstructions of continuously weighted adjacency matrix? Thank you so much for your time.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tkipf/gae/issues/28?email_source=notifications&email_token=ABYBYYGRXWF6NYUFYBHPYQLPWRF7XA5CNFSM4HCBTUQ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODV462NQ#issuecomment-494529846, or mute the thread https://github.com/notifications/unsubscribe-auth/ABYBYYHFITK62TULT54XGIDPWRF7XANCNFSM4HCBTUQQ .

tkipf avatar May 21 '19 20:05 tkipf