General doubts of node prediction model #352
Replies: 3 comments 1 reply
-
Hey, thanks for this very detailed question, it makes it really easy to answer. So to answer point by point:
loader_te = DisjointLoader(data_te, node_level=True, epochs=1, batch_size=1)
for data in loader_te:
inputs, targets = data
pred = model(data)
# Do whatever with `pred` Let me know if you need more help! |
Beta Was this translation helpful? Give feedback.
-
Hey @danielegrattarola . Thanks for your quick and detailed reply. I understood almost everything. I only don't understand why ECC doesn't consider the weights of the adjacency matrix. Therefore, how can the model understand the neighbours importance of one node?. If I understand what you explained to me, ECC compute the message from node i to node j as W(i, j) @ x_i, where W(i, j) have e_ij features as parameters. But, it should use the adjacency matrix to understand what are the neighbours (doesn't matter if is weighted or not). If it is weighted, therefore, it could understand the neighbors it should pay more attention to. Am I right?. In this sense, it could aggregate the neighbour messages appropiattely. |
Beta Was this translation helpful? Give feedback.
-
Thanks @danielegrattarola. It is much clearer to me. |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
I am here to share different doubts about my node prediction model. First, I am going to introduce the problem. At the end I'll ask the questions.
I present the structure of my graph. Each node has 360 features that corresponding to a time series of 360 samples between 0 and 1 amplitudes. I will connect each node by a specific condition. The important thing is that there are three type of edges. And each edge is weighted according to the inverse of the distance between two stations that recorded the time series. By the other hand, each node only could be linked if it corresponds to a time series of the same day. Finally, the idea is predict a label 360 samples in length between 0 and 1 amplitudes (other time series).
The above was implemented as follows. Let "i" the index to reference the day "i". The graph by day G_i is designed by [x_i,e_i,a_i]. Where:
For use in Spektral, I create my customs dataset as recommend here. The read method returns a list of graphs by day.
data = MyDataset(...,transforms=NormalizeAdj(symmetric=True)))
F = data.n_node_features # Dimension of node features ->360
S = data.n_edge_features # Dimension of edge features -> 3
n_out = data.n_labels # Dimension of the target -> 360
Nodes of different days must not exchange information. Therefore, I am going to use DisjointLoader to load disconnected graphs.
data_tr = data[idx_tr] #where idx_tr is the index list of the different graph
loader_tr = DisjointLoader(data_tr,...,node_level=True)
To build the model. I first think about tu use traditional NNs in the node features to extract high level representations. Such as Conv1D, NiN and LSTM. After, I get new features in the nodes to use GNNs.
`
class MyModel(Model):
def init(self):
super().init()
model = MyModel
optimizer = Adam(lr=learning_rate)
model.compile(optimizer=optimizer, loss=BinaryCrossentropy(),
metrics=["binary_accuracy"])
model.fit(loader_tr.load(), steps_per_epoch=loader_tr.steps_per_epoch,
epochs=100)
`
When I run the model no errors happen but I'm not sure what I'm doing.
Doubts:
When I use
x, a, e, i = inputs
, x,a,e come from disconnected graphs? . The question is because after the traditional NN blocks, I pass them to ECCConv. Therefore, I don't know if disconnected graphs are sharing information. It's what I don't want. How do I know that the new embedding will feed by connected nodes of the corresponding graph (i.e., nodes of the same day)?. I mean, nowhere am I using the index i that tells me which graph it corresponds to.Am I connecting traditional NNs and GNNs well?. I mean, Is "tf.expand_dims(x, axis=1)" the correct way to begin?. 1D convolution on sequences expects a 3D input. I am not sure because the new shape is (N_nodes, 1, 360). why not (1,N_nodes,360)?
I don't know if ECCConv will be a good layer because it computes learning weights to predict edge features. But what happen with the adjacency matrix weights. In my graph these weights are important too. I don't kown if this weight are being considered.
In the prediction I also use Disjoint loader,
loader_te = DisjointLoader(data_te,,node_level=True)
. To predict, I usepredictions = model.predict(loader_te.load(), steps=loader_te.steps_per_epoch)
. How can I get the predictions by the corresponding day graph.Thank you for your support
Regards.
Beta Was this translation helpful? Give feedback.
All reactions