New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why is the adjacency matrix taken in to graph convolutional layers each time? and self loops #364
Comments
Hi,
Cheers |
Hi @danielegrattarola , thank you for such a quick response!
and then code identical to above, but adjacency input layer now includes the preprocessed adjacency (self loops and GCNconv.preprocess) - I am guessing this is now correct and GCNconv.preprocess only needs to be called once on the matrix? - also, is there computation speedup of working with a sparse matrix instead of the entire adjacency matrix? In other words is One last question i have is, i thought the normalisation was relative to node degree for any given node. I see that the first element in the adjaceny matrix has a value of 0.5 (or 0.6 with self loops) but this node has the lowest degree (1)... is there a justification for this way of normalising? thanks again! |
If you use
Yes
Yes, the difference is that with sparse matrices the computation costs O(n_edges) while with dense matrices it costs O(n_nodes^2)
I suggest you to fix the computation first, and then dig into the function to see how it is computed. |
no problem, and thank you so much! so just:
correct? so now this would be ready for input in to the conv layers? I have re-run this and looked at the normalised adjacency matrix - i still get higher values with nodes that have a lower degree! |
Yes, that is correct. What you are observing is expected, if a node has a low degree its neighbours are relatively more important. |
thank you so much for all of your help this afternoon - I did a little more reading on the normalisation and understand also why lower degrees can have more weigthing! finally - just while you are here - the
can i confirm that 1. this format does not interfere with any of the processes of |
Sure, no problem!
|
perfect, thank you very much!! I appreciate all your time :) |
You're welcome!! |
sorry @danielegrattarola - yes you are right: it is:
without the last line, it was giving me a datatype error, so, |
Hi!
I am building a graph convolutional network which will be used in conjunction with a merged layer for a reinforcement learning task.
I have a technical question about the convolutional layer itself which is slightly confusing to me which is: why is the adjacency matrix passed in to each conv layer and not ONLY the first one? My code is as follows:
and my second question is about the normalise_adjacency - it does not add self loops. Should self loops be added before or after normalising the matrix?
thank you!
The text was updated successfully, but these errors were encountered: