Giter VIP home page Giter VIP logo

t-gcn's People

Contributors

amandalulu1998 avatar geox-lab avatar lehaifeng avatar martinwhl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

t-gcn's Issues

tgcn model

Hi , I have read your paper and try to understand the model but I got some problems. i am not quite understand that why the state part (which I thought that is a gru thing) , would also be send into the graph conv function? I am just a rookie on gcn and gru , hope I could get some help, thanks.

Errors on ops

I found error in the code tgcn.py

_ops.RegisterShape("GRUBlockCell")(None)
AttributeError: module 'tensorflow.python.framework.ops' has no attribute 'RegisterShape'

Thank you.

Can T-GCN deal with multivariate time series features?

Hi,
I would really appreciate it if you can help with the issues:

  1. It seems that GCN_LSTM is a univariate time series forecasting method. Is it possible to use multivariate time series features to build the model? ( I found relevant issue on #21 but failed to find the knowledge graph)

  2. Can non-time series feature be added to the model?

  3. So the architecture comprises of a stack of N1 Graph Convolutional layers followed by N2 LSTM layers, a Dropout layer, and a Dense layer. Am I correct?

Thank you so much for your help!

class tgcnCell

Could someone please give some explanation about tgcn.py.

How can i use this code in classfication problem?

Sorry to bother you,I have studied your paper and code in recent days.and i am deeply inspired by your idea,During the study period,two questions occour in my mind.
1,if i want to categorize articles that have references to each other,which part of code do i need to modify?
2,I noticed that the adjency matrix is not only contain 0 and 1,how to understand that?
Looking forward to your reply

关于遇到的一些问题

你好,我仔细阅读了这篇论文(我就不用英文了)
主要想请教两个问题,

  1. trainX, trainY, testX, testY = [], [], [], []
    for i in range(len(train_data) - seq_len - pre_len):
    a = train_data[i: i + seq_len + pre_len]
    trainX.append(a[0 : seq_len])
    trainY.append(a[seq_len : seq_len + pre_len])
    for i in range(len(test_data) - seq_len -pre_len):
    b = test_data[i: i + seq_len + pre_len]
    testX.append(b[0 : seq_len])
    testY.append(b[seq_len : seq_len + pre_len])
    第一个是这段代码中的实际意义我不是很清楚,我只能发现可以解决数组越界这一个问题,所以想请教一下代码的实际含义。
    2.第二个是论文中的两个数据集都是预测了之后15min,30min,45min以及60min的数据,但两个数据集的时间间隔是不一样的,Los-loop数据集的时间间隔是5min。以15min为例,这样是可以预测到后3个时间间隔的速度么?

TCN Pytorch 版本是否还未完善?

您好!
我注意到 TCN 的代码里面最后给出的是 每个units的输出 (batch_size, num_nodes, num_gru_units),作者是否打算截取最后一个unit 的输出, 并变换成 (batch_size, num_nodes, len_for_predict)?

Flag declaration problem

In main.py line 30 it should be DEFINE_float instead of DEFINE_integer since you're using 0.8 as the value.

Cheers and tank you for sharing the code.

Some questions on baseline.py

Hi lehaifeng!

We are going to try a traffic speed prediction based on your T-GCN and we are trying your baselines.py for our understanding. We are grateful if you would throw more lights on

  1. how the periods = 5664 could be used as len(data.index) equals to 2016 only.
  2. Why rmse of HA in Table 1 of the paper https://arxiv.org/pdf/1811.05320.pdf appears the same across T = 15, 30, 45, 60 mins.
  3. Which ARIMA model you are using? ARIMA(1,0,0)?

Thanks in advance.

Data source

Hi. I really liked your paper.

  1. Can you provide the link of the online repository from where you took data for your experiments?
  2. https://www.cs.rutgers.edu/~dz220/data.html is this the site for shehnzen data?
  3. where did you get the data for the adjacency matrix data for connectivity among the nodes? Did you do it manually?

about tensorflow.contrib.rnn

there is an error "no module named tensorflow.contrib.rnn" in tf2.0, is there any alternative way to import this?
Thank you!

tensorflow 版本

请问下实现这个的tensorflow版本是多少吗,希望能复现下模型训练 。

Standalone GRU code

@lehaifeng Could you please upload the standalone GRU code. I have been tuning my network but I am unable to reach the accuracy stated in the paper.
Thanks

How to deal with time deviation?

Thanks again your meaningful article and code.
I have a question here: We know that the speed of a point depends on the speed of the previous points. For example, a car drive into expressway and pass the point A at time t, and it will effect the point B at time t+Δt. So there is a time deviation Δt between A and B. So after you capture the spatial feature by GCN, will the time deviation impress the effect of LSTM ?Is it necessary to involve attention mechanism like GAT to solve this problem? Looking forward to your opinion.

万分感谢!

您写的代码非常优美,上传的内容也非常完整,我已经复现!让我这个新手学到了很多,非常感谢您。

Pytorch Version

Hello Haifeng,

thanks for your amazing. Could you also provide the PyTorch version code?

details about experiments

In this paper, the next 15,30,45,60min is predicted, this means the prediction length on los-loop is [1,2,3,4], and on Sz-taxi is [3,6,9,12]?

How do you get the adjacency matrix of sz or los?

hi mr le
thank u for your contribution of the open source code and data :D
I am doing traffic speed predication of changsha now,but I met a problem when i process the road network data。。。can i ask how do you get the adjacency matrix of sz?thank u very much!!!

Topological tolerance

Thanks for the code sharing.

I got a similar case with traffic speed on road network as data and I convert the road network to line graph for GCN.

My case got a bit tricky: road network may change; some road may be blocked due to reconstructing.

My question is what will be the tolerance of the GCN model to edge change? I don’t know how to quantify, but it would be great if you share us your experience. Thanks in advance.

您好,关于训练结果可视化的问题。

您好,打扰您一下,我用的是pytorch版本的代码,第55行代码也修改成为loss = self.loss(predictions, y),在电脑上运行完毕后,正确率一直是在85%左右。
第二个问题是,最终的训练结果可视化,在代码中,是定义了显示图片的函数,但是运行结束后,似乎是没有图片显示出来的
[2021-04-12 09:57:37,792 INFO]val_loss│RMSE│MAE│accuracy│R2│ExplainedVar│train_loss
─────────────────────────────────────────────────────
73.09178161621094│8.549372673034668│6.055265426635742│0.8544564843177795│0.6201916933059692│0.6203931570053101│0.007503977511078119

关于sz_speed数据集的问题

你好,乐先生!请教你一个问题,你在论文中提到的关于sz_speed数据集中,说到“每行代表一条路;每一列是不同时间段道路上的交通速度。我们每15分钟汇总一次每条路上的交通速度“,但我在深圳数据集中看到的是2977行、156列,这是你论文中提到的不符,能否告知一下这是为什么?

Why not GAT?

I think u can use attention mechanisms to make spatial and temporal features more prominent.

How to run GCN model?

The output'shape of _gconv function(in gcn.py) is [batch*, self._output_dim, self._num_nodes], but the weights['out']'s shape is [gru_units, pre_len], need to redefine a fully connected layer to generate for GCN?
Thank you very much for uploading your paper's code.
Thank you!

tgcn中如何结合gcn和gru

您好:我最近在阅读您发表的T-GCN这篇论文,并学习了您的代码。我是一位初学者,关于代码有几个问题,想请教您。
在代码tgcn中,您是否先用图卷积gcn处理邻接矩阵得到结果,再把这个结果和道路属性特征(即每条道路的时间序列数据)一起作为gru的输入吗?两者是如何结合在一起作为gru的输入?我有一些困惑。
其次,我想了解图卷积gcn处理邻接矩阵得到的输出是什么?
希望您在百忙之中可以回复我的问题,非常感谢!

GCN code

hi, thank you for sharing. I've studied your paper and code and have some questions:

  1. according your paper, the gcn model is expressed as:
    f(X, A) = act(A Relu (AXW0) W1)

    but in tgcn.py, it seems like:
    f(X, A) = AXW0 + b0

    in gcn.py, it looks like:
    f(X, A) = act(AXW0)W1 (act is tanh by default)

    do I misunderstand it ?

  2. the following code in gcn.py & tgcn.py:
    for adj in self._adj:
    x1 = tf.sparse_tensor_dense_matmul(adj, x0)
    in your implementation, the self._adj is a list that contains only one element, that's OK.
    but if it contains more than one element? the loop seems to have no effect, it only uses
    the last element.

performance is not good

I run the code, but I can't reach the author's good performance in the paper, the accuracy is lower, and even the r2 and var sometimes is negative.

graph convolution process in `tgcn` cell

Hi @lehaifeng,

Once again, thanks for pasting the code here. I got a question on the graph convolution when I read tgcn.py.

T-GCN/tgcn.py

Lines 53 to 62 in 24fc8d8

x_s = tf.concat([inputs, state], axis=2)
input_size = x_s.get_shape()[2].value
## (num_node,input_size,-1)
x0 = tf.transpose(x_s, perm=[1, 2, 0])
x0 = tf.reshape(x0, shape=[self._nodes, -1])
scope = tf.get_variable_scope()
with tf.variable_scope(scope):
for m in self._adj:
x1 = tf.sparse_tensor_dense_matmul(m, x0)

As above, it seems to me that the convolution is

ql_36361ffe3511d210798d4cdb1415a82f_l3

instead of

ql_9830f373b0708043aba2483a7353524e_l3

similar for r_t and c_t, as written in the paper (https://arxiv.org/pdf/1811.05320.pdf). Not sure if I am misunderstood. Mind throwing some lights to me? Thanks in advance.

what is the shape of Xt?

in paper , you say Xt ∈ RN×i is used to represent the speed on each road at time i. I feel confused it.

how to restore pre-trained meta model and pass it's weights and biases to the optimizer?

Hey Mr.Haifeng

I trained a model on a specific dataset and saved it as a meta, I want to restore the model and use its weights and biases on another dataset the code isn't mine but I'm trying to restore the architecture after it was saved to metafile.

I tried many workarounds and ran into numerous errors I can't post all of them here, is it possible to do transfer learning using this architecture, I can use this architecture on any new dataset, but I can't reuse the trained model variables on another data set.
Should I save operations done in the original graph and then call them in the new code.?

This is the code I'm using to restore weights and biases as well as placeholders.

sess=tf.Session()    
saver2 = tf.train.import_meta_graph('TGCNpretrain.model.meta')
saver2.restore(sess, tf.train.latest_checkpoint('./'))
print("model restored")
graph = tf.get_default_graph()
print(tf.compat.v1.trainable_variables())
print("------------------------------------------------------------------------------")

weights ={
    'out2':[v for v in tf.trainable_variables() if v.name == "weight_o:0"][0]}
biases ={
    'out2':[v for v in tf.trainable_variables() if v.name == "bias_o:0"][0]}
###### placeholders ######
inputs = tf.get_default_graph().get_tensor_by_name('inputs1:0')
labels = tf.get_default_graph().get_tensor_by_name('labels1:0')

y_pred = inputs

###### optimizer ######
Lreg = sum(tf.nn.l2_loss(tf_var) for tf_var in tf.trainable_variables())

label = tf.reshape(labels, [-1,num_nodes])
##loss
loss = tf.reduce_mean(tf.nn.l2_loss(y_pred-label) + Lreg)
##rmse
error = tf.sqrt(tf.reduce_mean(tf.square(y_pred-label)))
optimizer = tf.train.AdamOptimizer(lr).minimize(loss)


I don't know what to pass to the optimizer, loss and error equations, I tried several combinations as shaping error all the time
ValueError: Shapes must be equal rank, but are 2 and 1 From merging shape 4 with other shapes. for 'Rank/packed' (op: 'Pack')
I also run this error very often
raise ValueError(str(e)) ValueError: Duplicate node name in graph: 'weight_o/Adam'

output about test_result file

Hi Mr Le
in paper T-GCN, about SZ-taxi dataset, This dataset consists of the taxi trajectory of Shenzhen from Jan. 1 to Jan. 31, 2015 and you aggregated the traffic speed on each road every 15 minutes. 80% of the data is used as the training set and the remaining 20% is used as the test set, that means Jan.27-Jan.31 is the prediction result. However, in test_result(result of prediction ) file, there are 591 rows that does not match Jan.27-Jan.31. In theory, it should be 576 rows. I have the same question on another data set.
I am looking forward to your reply Thank you!

Use TGCN for dynamic graphs

Hi, It would be so nice if you specify how we can use TGC for dynamic graphs with different adjacency matrix and feature matrix in each snapshot?

Details on evlaution

Hi!

I wondering you trained 4 different T-GCN models to predict 15,30,45, and 60 minutes later.
or you reused the one T-GCN model to predict 4 different scenarios. cuz the T-GCN is based on RNN, if you feedback the output of T-GCN to the input, it can predict any point of future in theory. isn't it?

Thanks,
Jun

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.