mdeff / cnn_graph

Convolutional Neural Networks on Graphs with Fast Localized Spectral Filtering
https://arxiv.org/abs/1606.09375
MIT License
1.33k stars 390 forks source link

Convolution with full spectral domain filter #31

Open pinkfloyd06 opened 6 years ago

pinkfloyd06 commented 6 years ago

Hello @mdeff

Let me thank you for this notebook showing different graph convolution implementation.

https://github.com/mdeff/cnn_graph/blob/master/trials/1_learning_filters.ipynb

l'm wondering if you have an optimized implementation of a convolution in a full spectral domain filter (instead of chebyshev expansion) ?

x ∗ G g = U.T ( diag(w_g)Ux) (link : page3 https://arxiv.org/pdf/1506.05163.pdf) such that : x: input spectral multipliersw_g = ( w_1 ,...,w_N ) U: eigenvectors U.T: transposed eigenvectors

Here is what l've tried

def graph_convolution(x,U,lambda):
       '''
       graph convolution layer on full spectral domain filter for graph classification

       x : dimension( n,z). where n is the number of nodes and z the number of features per node
      U : eignevectors dim (n,n). where n is the number of nodes
      lambda :  diagonal matrice of eigenvalues dim(n,n). where n is the number of nodes
       '''

      x1=lambda*x
      x2= U*x1
      # Let's say n=32 and z=3 then x2=[32,3]
      # convolution layer input :  32 output 100
      cl1 = nn.Linear(32,100,3) # pytorch version
      x=cl1(x2) # output x is of dim [100,3]

     return x

Please correct me. Thank you,

mdeff commented 4 years ago

https://github.com/mdeff/cnn_graph/blob/c4d2c75d1807a1d1189b84bd6f4a0aafca5b8c53/lib/models.py#L387-L421