danielegrattarola / spektral

Graph Neural Networks with Keras and Tensorflow 2.
https://graphneural.network
MIT License
2.36k stars 334 forks source link

GraphConv layer for prediction #64

Closed demiding0729 closed 3 years ago

demiding0729 commented 4 years ago

Hi Daniele, I am trying to use Graph Convolutional Networks to forecast traffic flows between origin and destination cities. I only have one graph so it should be a single mode. I am wondering is it possible to get a matrix format output (N*N) using GraphConv layer and LSTM layer? Will this output considering both the interactions between origin cities and destination cities? I will really appreciate your kind help. Thanks!

danielegrattarola commented 4 years ago

Hi,

GCNs usually have the node features as input and output. What you are trying to achieve sounds like a link prediction task. Usually, this is done by first learning a representation of the node features with a GNN, and then using some similarity function to predict the presence/absence of a link.

A very simple approach to this is the variational graph autoencoder by Kipf et al., where they compute a representation Z and then do the link prediction as sigmoid(Z*Z^T). If you want to predict a continuous variable, you can remove the sigmoid or do something different, but the idea is that your output should be a function of node pairs.

Hope this helps. Best, Daniele