zhiyongc / graph_convolutional_lstm Goto Github PK
View Code? Open in Web Editor NEWTraffic Graph Convolutional Recurrent Neural Network
License: MIT License
Traffic Graph Convolutional Recurrent Neural Network
License: MIT License
Hi,
I'm trying out your code to gain a better understanding of the whole concept, but I get an error:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-21-5955e675779a> in <module>
2 back_length = 3
3 Clamp_A = False
----> 4 gclstm = GraphConvolutionalLSTM(K, torch.Tensor(A), FFR[back_length], A.shape[0], Clamp_A=Clamp_A, output_last = True)
5 gclstm, gclstm_loss = TrainModel(gclstm, train_dataloader, valid_dataloader, num_epochs = 1)
6 gclstm_test = TestModel(gclstm, test_dataloader, max_speed )
<ipython-input-17-b87e6355c7f7> in __init__(self, K, A, FFR, feature_size, Clamp_A, output_last)
28
29 # a length adjustable Module List for hosting all graph convolutions
---> 30 self.gc_list = nn.ModuleList([FilterLinear(feature_size, feature_size, self.A_list[i], bias=False) for i in range(K)])
31
32 hidden_size = self.feature_size
<ipython-input-17-b87e6355c7f7> in <listcomp>(.0)
28
29 # a length adjustable Module List for hosting all graph convolutions
---> 30 self.gc_list = nn.ModuleList([FilterLinear(feature_size, feature_size, self.A_list[i], bias=False) for i in range(K)])
31
32 hidden_size = self.feature_size
NameError: name 'FilterLinear' is not defined
FilterLinear
is not something you defined, and it's not something you import either. Do you remember where it comes from?
Obviously, since it's been a while since you posted your code I am not running the same version of PyTorch (1.12.1+cu116
instead of 0.42
), but it doesn't seem like it's an import as you're not doing any import star.
With your code I was able to obtain the validation loss graph which looks similar to yours (10^-4) for the Seattle Loop Detector dataset. But when I tried to do a comparison between actual vs predicted, it's not even close to what is shown in your paper. Can you tell me if you are doing something differently or you are using a different code altogether?
Below is the predicted vs actual speed graph for your reference.
Thanks,
Suhas
if i have a raw data,how can i get the FFR matrix?
Hello, I'm sorry to bother you, but I can't open the Seattle data link you gave me, so I hope you can share the Seattle detector data again. Thank you
File "/data/home/u19120777/Graph_Convolutional_LSTM-master/Code_V1/Train_Validate.py", line 108, in TrainRNN
loss_interval_train = np.around(sum(losses_train[-interval:]).cpu().numpy()[0]/interval, decimals=8)
IndexError: too many indices for array: array is 0-dimensional, but 1 were indexed
my pytorch version is 1.1 python version is 1.7 and I run this model with gpu, but I get troubled with this error..
Hello,
I tried running your code but it was not successful.
python Main.py
Here is the detail error:
Epoch 0/0
----------
Traceback (most recent call last):
File "Main.py", line 93, in <module>
rnn, rnn_loss = TrainRNN(train_dataloader, valid_dataloader, num_epochs = 1)
File "/home/tiendh/Projects/IoT++/Graph_Convolutional_LSTM/Train_Validate.py", line 72, in TrainRNN
loss_train = loss_MSE(outputs, labels)
File "/home/tiendh/deeplearning_env/lib/python3.5/site-packages/torch/nn/modules/module.py", line 477, in __call__
result = self.forward(*input, **kwargs)
File "/home/tiendh/deeplearning_env/lib/python3.5/site-packages/torch/nn/modules/loss.py", line 421, in forward
return F.mse_loss(input, target, reduction=self.reduction)
File "/home/tiendh/deeplearning_env/lib/python3.5/site-packages/torch/nn/functional.py", line 1716, in mse_loss
return _pointwise_loss(lambda a, b: (a - b) ** 2, torch._C._nn.mse_loss, input, target, reduction)
File "/home/tiendh/deeplearning_env/lib/python3.5/site-packages/torch/nn/functional.py", line 1674, in _pointwise_loss
return lambd_optimized(input, target, reduction)
RuntimeError: input and target shapes do not match: input [40 x 323], target [40 x 1 x 323] at /pytorch/aten/src/THCUNN/generic/MSECriterion.cu:12
Actually, I had to enable the line train_dataloader, valid_dataloader, test_dataloader, max_speed = PrepareDataset(speed_matrix)
to pass the very first error.
Am I doing something wrong? Please guide me how to run your code.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.