gcn icon indicating copy to clipboard operation
gcn copied to clipboard

multiple "support"

Open AkandaAshraf opened this issue 7 years ago • 4 comments

Hi

I was wondering about the "num_supports=1".

Is it possible to input multiple supports? Let's say for a graph with different types of connections can I input two different adj matrices / supports?

       support = list()
       support.append(sp.coo_matrix(adj1))
       support.append(sp.coo_matrix(adj2))

It looks like that the "sparse_to_tuple" function is written to deal with list inputs and also the convolve operation seem to have (layers.py line#240):

        supports.append(support)
    output = tf.add_n(supports)

Did you intend to have this feature which is to be able to deal with two different adj matrices for the same graph?

I tried to pass a support with a list of two adj matrices, however, I am getting an error when I tried to do this:

File "D:/gcn/gcn-master/gcn/akanda.py", line 488, in experiment outs = sess.run([model.opt_op, model.loss, model.accuracy], feed_dict=feed_dict) File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\client\session.py", line 900, in run run_metadata_ptr) File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1104, in _run np_val = np.asarray(subfeed_val, dtype=subfeed_dtype) File "C:\Program Files\Python36\lib\site-packages\numpy\core\numeric.py", line 492, in asarray return array(a, dtype, copy=False, order=order) ValueError: setting an array element with a sequence.

Thanks a lot!

AkandaAshraf avatar Aug 28 '18 17:08 AkandaAshraf

Yes this feature was intended. Unfortunately the API of tensorflow changed in the meantime which gives you this error I suppose. You might want to try feeding the adjacency matrices as we did in the ‚recommender-gcn‘ repository by Rianne van den Berg (I currently don’t have Internet access while writing this, but if you look this up on Google you should find it). Hope this helps! On Tue 28. Aug 2018 at 18:09 AkandaAshraf [email protected] wrote:

Hi

I was wondering about the "num_supports=1".

Is it possible to input multiple supports? Let's say for a graph with different types of connections can I input two different adj matrices / supports?

   support = list()
   support.append(sp.coo_matrix(adj1))
   support.append(sp.coo_matrix(adj2))

It looks like that the "sparse_to_tuple" function is written to deal with list inputs also the convolve operation seem to have (layers.py line#240):

    supports.append(support)
output = tf.add_n(supports)

Did you intend to have this feature which is to be able to deal with two different adj matrices for a same graph?

I tried to pass a support with a list of two adj matrices, however I am getting an error when I tried to do this:

File "D:/gcn/gcn-master/gcn/akanda.py", line 488, in experiment outs = sess.run([model.opt_op, model.loss, model.accuracy], feed_dict=feed_dict) File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\client\session.py", line 900, in run run_metadata_ptr) File "C:\Program Files\Python36\lib\site-packages\tensorflow\python\client\session.py", line 1104, in _run np_val = np.asarray(subfeed_val, dtype=subfeed_dtype) File "C:\Program Files\Python36\lib\site-packages\numpy\core\numeric.py", line 492, in asarray return array(a, dtype, copy=False, order=order) ValueError: setting an array element with a sequence.

Thanks a lot!

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

tkipf avatar Aug 31 '18 09:08 tkipf

multiple "support" means multiple graph?

guotong1988 avatar Sep 11 '18 08:09 guotong1988

Each ‘support’ is an adjacency matrix, so you can see it as multiple graphs, yes. On Tue 11. Sep 2018 at 09:03 Tong Guo [email protected] wrote:

multiple "support" means multiple graph?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tkipf/gcn/issues/54#issuecomment-420184664, or mute the thread https://github.com/notifications/unsubscribe-auth/AHAcYB4zA7K9PY1LH22qYYPcm5h-ovwBks5uZ25lgaJpZM4WQCQc .

tkipf avatar Sep 11 '18 08:09 tkipf

Thx for your reply!

guotong1988 avatar Sep 11 '18 08:09 guotong1988