This is an implementation of Spatio-Temporal Graph Convolutional Networks: A Deep Learning Framework for Traffic Forecasting which has been accepted by IJCAI 2018.
mxnet >= 1.3.0
pandas
numpy
sklearn
python main.py
You can construct your adjacency matrix and graph signal matrix like the function data_preprocess
in 'main.py'.
Using
from lib.utils import *
L_tilde = scaled_Laplacian(A.asnumpy())
cheb_polys = [nd.array(i, ctx = ctx) for i in cheb_polynomial(L_tilde, 3)
to compute chebyshev polynomials.
Using
from model import STGCN
backbones = [
{
'num_of_time_conv_filters1': 32,
'num_of_time_conv_filters2': 64,
'K_t': 3,
'num_of_cheb_filters': 32,
'K': 1,
'cheb_polys': cheb_polys
},
{
'num_of_time_conv_filters1': 32,
'num_of_time_conv_filters2': 128,
'K_t': 3,
'num_of_cheb_filters': 32,
'K': 1,
'cheb_polys': cheb_polys
}
]
net = STGCN(backbones, 128)
net.initialize(ctx = mx.cpu()) # or mx.gpu(0)
to initialize a new model.
dataset comes from PEMS, we sampled a little from Bay area. You can get sampled data from "data" folder.
The file "distance.csv" contains the distance between two stations, which we linked together.
The file "graph_signal_data_small.txt" contains the time series of each station, it's in a json format, you can use the function "data_preprocessing" in main.py to read it.