liyaguang / DCRNN

Implementation of Diffusion Convolutional Recurrent Neural Network in Tensorflow
MIT License
1.21k stars 400 forks source link

hello! I have confused with diffusion step! #47

Closed Dukering closed 3 years ago

Dukering commented 5 years ago

I've read the codes! In the codes, i think you just use Chebyshev polynomial and replace ~L with D^-1W: for support in self._supports: x1 = tf.sparse_tensor_dense_matmul(support, x0) x = self._concat(x, x1) for k in range(2, self._max_diffusion_step + 1): x2 = 2 * tf.sparse_tensor_dense_matmul(support, x1) - x0 x = self._concat(x, x2) x1, x0 = x2, x1 It's different from Diffusion Convolution. Is that the Chebyshev polynomial includes the diffusion convolution?

qq563902455 commented 4 years ago

I have the same question. I can't find the diffusion convolution in this repo. is it really the corresponding codes of the paper(DIFFUSION CONVOLUTIONAL RECURRENT NEURAL NETWORK: DATA-DRIVEN TRAFFIC FORECASTING)?

liyaguang commented 4 years ago

Thanks for the question. The key difference between several convolution methods is the "adjacency matrix" used for aggregating neighborhood nodes, where diffusion convolution uses the combination of the two random walk matrices D_O^-1W and D_{I}^{-1} W, which other may use the the (normailzed) Laplacian matrix

Chebyshev polynomial is a way to get more stable gradient (by changing to a different basis), DCRNN also uses the techniques to get more stable training. More dicussion about diffusion convolution and other graph convolution methods provided in the Appendix C of the paper

qq563902455 commented 4 years ago
            for support in self._supports:
                x1 = tf.sparse_tensor_dense_matmul(support, x0)
                x = self._concat(x, x1)

                for k in range(2, self._max_diffusion_step + 1):
                    x2 = 2 * tf.sparse_tensor_dense_matmul(support, x1) - x0
                    x = self._concat(x, x2)
                    x1, x0 = x2, x1

In the computation of reverse diffusion(second element of self._support), the codes provided in this repo may be not correct. After the computation of diffusion, x0 may need to be set to the raw input, but not be set to last x1 in the computation of diffusion.

hazdzz commented 3 years ago

I've read the codes! In the codes, i think you just use Chebyshev polynomial and replace ~L with D^-1W: for support in self._supports: x1 = tf.sparse_tensor_dense_matmul(support, x0) x = self._concat(x, x1) for k in range(2, self._max_diffusion_step + 1): x2 = 2 * tf.sparse_tensor_dense_matmul(support, x1) - x0 x = self._concat(x, x2) x1, x0 = x2, x1 It's different from Diffusion Convolution. Is that the Chebyshev polynomial includes the diffusion convolution?

I found another paper that truly offers Graph Diffusion Convolution. The name of that paper is Diffusion Improves Graph Learning. In that paper, the author defines Graph Diffusion Convolution (personalized PageRank) and Graph Diffusion Convolution (Heat Kernel).

I've checked the formulations and the code, the Diffusion Convolution defined in DCRNN is just the Graph Convolution of ChebyNet which using L_{rw}. It is not the true Graph Diffusion Convolution.

hazdzz commented 3 years ago

I have the same question. I can't find the diffusion convolution in this repo. is it really the corresponding codes of the paper(DIFFUSION CONVOLUTIONAL RECURRENT NEURAL NETWORK: DATA-DRIVEN TRAFFIC FORECASTING)?

Here, I offer the correct diffusion matrix as below:

GDC(PPR)

hazdzz commented 3 years ago

I would open my code in GitHub later. https://github.com/hazdzz/GCGRU

yuqirose commented 3 years ago

I've read the codes! In the codes, i think you just use Chebyshev polynomial and replace ~L with D^-1W: for support in self._supports: x1 = tf.sparse_tensor_dense_matmul(support, x0) x = self._concat(x, x1) for k in range(2, self._max_diffusion_step + 1): x2 = 2 * tf.sparse_tensor_dense_matmul(support, x1) - x0 x = self._concat(x, x2) x1, x0 = x2, x1 It's different from Diffusion Convolution. Is that the Chebyshev polynomial includes the diffusion convolution?

I found another paper that truly offers Graph Diffusion Convolution. The name of that paper is Diffusion Improves Graph Learning. In that paper, the author defines Graph Diffusion Convolution (personalized PageRank) and Graph Diffusion Convolution (Heat Kernel).

I've checked the formulations and the code, the Diffusion Convolution defined in DCRNN is just the Graph Convolution of ChebyNet which using L_{rw}. It is not the true Graph Diffusion Convolution.

There are different variations of diffusion defined on graphs. But the key ideas are the same: the discretization of the function derivative (difference) according to the node degree. Essentially they are using the spectral information to aggregate the features on the node.

Also see my reply from another ticket https://github.com/chnsh/DCRNN_PyTorch/issues/14#issue-793282772

maisuiqianxun commented 3 years ago

Suppose the used GCN unit is just the Graph Convolution of ChebyNet which using L_{rw}, @hazdzz I am still puzzled why the calculation of "x2" need to minus "x0"?

hazdzz commented 3 years ago

Suppose the used GCN unit is just the Graph Convolution of ChebyNet which using L_{rw}, @hazdzz I am still puzzled why the calculation of "x2" need to minus "x0"?

GCN is not the first order of ChebyNet.

maisuiqianxun commented 3 years ago

Suppose the used GCN unit is just the Graph Convolution of ChebyNet which using L_{rw}, @hazdzz I am still puzzled why the calculation of "x2" need to minus "x0"?

GCN is not the first order of ChebyNet.

Sorry, suppose the used Diffusion Convolution defined in DCRNN is just the Graph Convolution of ChebyNet which using L_{rw}, I am still puzzled why the calculation of "x2" need to minus "x0"?

mb-Ma commented 2 years ago

Does anyone try to adjust the code to fit the formula presented on paper? For example, cut the calculation of "x2" minus "x0".