Issue with graph size change when applying to a new dataset for predictions // and other (simple) questions #252
Replies: 2 comments
-
Hi,
Cheers |
Beta Was this translation helpful? Give feedback.
-
Hi Daniele, ok thanks for the answers. I figured it out.
and then in the model when I used X as an input:
Does that sound correct? model.fit() works but I just want to be sure. Then when I predict:
Thanks a lot! |
Beta Was this translation helpful? Give feedback.
-
Dear Daniele,
thank you first for your awesome package! I am starting now to use your package for a new research project combining CNN and GNN on the top. Since my aim is to use your package for making a new model for publication in a bioinformatic journal, I want to be sure I am not making any mistakes.
I have several questions/issues regarding node classification:
I noticed that if I train a model with a GCNConv layer with a graph A with size [100,100] for instance, and then if I want to predict for novel nodes from a new graph with for instance size [200,200], I got problem of shape, and the model can't be used. How can I fix that?
When using masks (in the examples given in spektral), you do:
def mask_to_weights(mask):
return mask.astype(np.float32) / np.count_nonzero(mask)
Thus here the binary mask is divided by the number of ones. I guess that the aim is that sum of weights equals to one for the three masks : weights_tr, weights_va, weights_te. Why? If I don't do that, what is consequence? I guess this is done to compare the some loss between training set and validation set when both don't have the same size. But for accuracy (which I use for monitoring training) this should not impact since there are normalized measure between 0 and 1.
I am using the code:
model.compile(optimizer=RMSprop(lr=learning_rate),
loss=binary_crossentropy,
weighted_metrics=['acc','AUC'])
where my masks are binary.
But in your code I see:
model.compile(
optimizer=Adam(learning_rate),
loss=CategoricalCrossentropy(reduction="sum"),
weighted_metrics=["acc"],
)
Should I used loss=CategoricalCrossentropy(reduction="sum")?
Another simple question I could not find response yet is: how is applied the mask? On which tensor? X (feature matrix), A (graph) or y (output)?
If I have a graph with nodes A, B, C and D, and if I have a table of columns (one column per feature and one line per node) and a binary vector output (one value per node). If I mask D during training, I know that the model will not try to use D for predicting D (but do it for A, B and C), but the model may try to use D for predicting A (for instance if A and D have a edge in the graph), but I don't want that of course! So my question is : when masking D, will the model try to use D for predicting A (for instance if A and D have a edge in the graph)? I hope this is not the case, since it will lead to data leaking during the training process.
Thanks!
Raf
Beta Was this translation helpful? Give feedback.
All reactions