Giter Site home page Giter Site logo

zhiyongc / graph_convolutional_lstm Goto Github PK

View Code? Open in Web Editor NEW
373.0 6.0 119.0 8.9 MB

Traffic Graph Convolutional Recurrent Neural Network

License: MIT License

Python 32.71% Jupyter Notebook 67.29%
traffic-graph-convolution traffic-flow-prediction graph graph-convolutional-networks lstm traffic-prediction traffic-forecasting

graph_convolutional_lstm's People

Contributors

zhiyongc 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

graph_convolutional_lstm's Issues

Missing import?

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.

Predicted vs Actual Speed Discrepancy

@zhiyongc

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.
Screen Shot 2019-07-22 at 12 36 05 PM

Thanks,
Suhas

IndexError

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..

How to run your code

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.

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.