iMoonLab / HGNN

Hypergraph Neural Networks (AAAI 2019)
MIT License
661 stars 128 forks source link

New HyperGraph #14

Closed shivamag125 closed 4 years ago

shivamag125 commented 4 years ago

Hi, Thanks for your work! I am running your code with a different hypergraph. Unfortunately, I get G as nan. Are there certain properties of the incidence matrix apart from n*m shape?

yifanfeng97 commented 4 years ago

Hi, Thanks for your attention. The nan in G may be caused by the zero degree of any hyperedge(D_e) or vertex (D_v). Then inf or nan will be generated by ^-1 or ^-1/2 operation. I have two suggestions:

  1. Please carefully check your incidence matrix H. Delete those hyperedges that not connect any vertices. And make sure there aren't any isolated vertex, which may cause the zero vertex degree.
  2. Replace inf with zero like: d_inv_sqrt[np.isinf(d_inv_sqrt)] = 0. Append the code behind computing the degree's inv_sqrt.

About the certain properties: The computation of G is just to reduce repeatability computation of DV, DE in hypergraph convolution. The raw H also can be fed into the hypergraph convolution. While the dv, de, W should be computed in any hypergraph convolution in this situation.

shivamag125 commented 4 years ago

Hi, Thank you for your prompt reply. The mentioned suggestions work as I expected.