Coder Social home page Coder Social logo

hpi-sam / gnn-spacetimegraphs Goto Github PK

View Code? Open in Web Editor NEW
15.0 3.0 3.0 18.56 MB

Graph Neural Networks utilization for Spatiotemporal graphs. These methods will be applied into the problem of forecasting traffic flow on PEMS-Bay, METR-LA and Seattle Loop Datasets

License: MIT License

Makefile 0.02% Python 2.52% Jupyter Notebook 97.45% Shell 0.01%
traffic-forecasting traffic-graphs graph-neural-networks spatio-temporal-data graph-convolutional-networks forecasting-algorithm

gnn-spacetimegraphs's Introduction

GNN-SpaceTimeGraphs

Setup

From your terminal, run the following commands sequentially

# Clone git repo && create a new env with required libraries
git clone https://github.com/hpi-sam/GNN-SpaceTimeGraphs.git
cd GNN-SpaceTimeGraphs
make env
conda activate gnn-env

# Download the metr-la and pems-bay data from 
# https://drive.google.com/file/d/1wD-mHlqAb2mtHOe_68fZvDh1LpDegMMq/view?usp=sharing
export fileid=1pAGRfzMx6K9WWsfDcD1NMbIif0T0saFC
export filename=data/metr_la/metr-la.h5
wget -O $filename 'https://drive.google.com/uc?export=download&id='$fileid

export fileid=1wD-mHlqAb2mtHOe_68fZvDh1LpDegMMq
export filename=data/pems_bay/pems-bay.h5
wget -O $filename 'https://drive.google.com/uc?export=download&id='$fileid

# Run utils script to process the data that is going to be used
python utils.py --output_dir=data/metr_la \
                    --traffic_df_filename=data/metr_la/metr-la.h5 --sts=True
python utils.py --output_dir=data/metr_la \
                    --traffic_df_filename=data/metr_la/metr-la.h5
python utils.py --output_dir=data/metr_la \
                    --traffic_df_filename=data/pems_bay/pems-bay.h5 --sts=True
python utils.py --output_dir=data/metr_la \
                    --traffic_df_filename=data/pems_bay/pems-bay.h5

If you find any problems with wget [...], you can manually download the datasets from this Google Drive link

To train a model, run the following command from the GNN-SpaceTimeGraphs folder

python run.py -c configs/p3d.yml --toy_data

Abstract

In Intelligent Transport Systems (ITS), traffic forecasting is a crucial tool to improve road security, planning and operation. Before using neural architectures, autoregressive models were employed for time-series forecasting which faced difficulties to model highly non-linear and spatially dependent traffic data. Speed sensors in road networks are arranged in graph like structures, therefore, spatial and temporal dependencies are often modeled based on traffic graphs. Because relationships of sensors are modeled in space and time concurrently, the effectiveness of each mechanisms needs to be isolated when comparing neural network architectures. Contrary to a formulation where edges in a traffic graph are predefined through physical road connections or closeness in space, there is a trend towards refining the structure of traffic graphs during the learning process. We propose a series of experiments based on spectral graph convolution using a concept introduced by Zhang et. al (AAAI 2020), which regards the graph laplacian as a learnable parameter. We compare this setup to one that uses a static laplacian. Additionally we use a latent correlation layer as proposed by Chao et. al (NeurIPS 2020) as another way of learning the laplacian. To keep the variants of the spectral convolution comparable the temporal modeling component stays fixed. The contributions of this work can be summarized answering the following two research questions (RQ):

  • RQ1: How does learning the graph structure affect the precision of predictions in graph neural networks for traffic forecasting?
  • RQ2: Do graph convolution operators benefit from having the graph structure as a learnable parameter?

We employ two widely used benchmark datasets and compare different setups to answer RQ1 and RQ2. We were able to reproduce results shown by Zhang et. al and extend the comparison to models that utilize a latent correlation layer.

gnn-spacetimegraphs's People

Contributors

christianadriano avatar ericschuma avatar tiborcamargo avatar tsanona avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

gnn-spacetimegraphs's Issues

Some minor errors in the README file

  1. In the utils script commands, the last two commands may need to change their "output_dir".
command 2. After the "train a model" command, the config file path points directly to "configs/p3d.yml", but it should point to "configs/hypertuning/p3d.yml". 3. Before training, you may need to create two folders, "./saved_models" and "./studies/losses". Otherwise you may get the exception "Parent directory ./saved_models does not exist".

I'm learning about traffic flow forecasting. Your code has helped me a lot, thank you! 🌹

你好,作者。想请教您的代码中layers文件中关于几个注意力模块的问题。

 我想请问一下,您的gnn文件中layers.py文件中的几个注意力模块的代码,比如AGC,ASGCP这几个模块,是否可以嵌入到其他的交通流预测的神经网络模型中,我尝试了放进神经网络中,都是报错了。想请教您是否有尝试过类似操作,是否可行,希望能指点一下。非常感谢您在百忙之中阅读此消息,期待您的早日回信,万分感谢!

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.