Skip to content

Latest commit

 

History

History
123 lines (111 loc) · 4.08 KB

README.md

File metadata and controls

123 lines (111 loc) · 4.08 KB

IJCAI 2022. FOGS: First-Order Gradient Supervision with Learning-based Graph for Traffic Flow Forecasting

image

Data Preparation

download STSGCN_data and unzip the file into data directory. The data directory is as follows:

FOGS/data/PEMS03/PEMS03.csv

FOGS/data/PEMS04/PEMS04.csv

Usage

1. temporal correlation graph

cd FOGS/node2vec-master/scripts
run graph_preparation.py

PEMS03

python graph_preparation.py --sensor_ids_filename ../../data/PEMS03/PEMS03.txt --num_of_vertices 358 --distances_filename ../../data/PEMS03/PEMS03.csv --data_filename ../../data/PEMS03/PEMS03.npz --edgelist_filename ../graph/PEMS03.edgelist --filename_T ../graph/PEMS03_graph_T.npz --flow_mean ../../data/PEMS03/PEMS03_flow_count.pkl

PEMS04

python graph_preparation.py --num_of_vertices 307 --distances_filename ../../data/PEMS04/PEMS04.csv --data_filename ../../data/PEMS04/PEMS04.npz --edgelist_filename ../graph/PEMS04.edgelist --filename_T ../graph/PEMS04_graph_T.npz --flow_mean ../../data/PEMS04/PEMS04_flow_count.pkl

2. embedding by random walk

cd FOGS/node2vec-master/src
run main_tra.py

PEMS03

python main_tra.py --input ../graph/PEMS03.edgelist --input_T ../graph/PEMS03_graph_T.npz --output ../emb/PEMS03.emb 

PEMS04

python main_tra.py --input ../graph/PEMS04.edgelist --input_T ../graph/PEMS04_graph_T.npz --output ../emb/PEMS04.emb 

3. spatio-temporal graph

cd FOGS/node2vec-master/scripts
run learn_graph.py

PEMS03

python learn_graph.py --filename_emb ../emb/PEMS03.emb --output_pkl_filename ../../data/PEMS03 --thresh_cos 10 

4. data preprocessing

cd FOGS/STFGNN/
run generate_datasets.py

PEMS03

python generate_datasets.py --output_dir ../data/processed/PEMS03/ --flow_mean ../data/PEMS03/PEMS03_flow_count.pkl --traffic_df_filename ../data/PEMS03/PEMS03.npz

5. train model

cd FOGS/STFGNN/
change DATASET = 'PEMS0X' in line 16 in train.py
run train.py

Citing

If you use FOGS in your research, please cite the following paper:

@inproceedings{DBLP:conf/ijcai/RaoWZLS022,
  author    = {Xuan Rao and
               Hao Wang and
               Liang Zhang and
               Jing Li and
               Shuo Shang and
               Peng Han},
  title     = {{FOGS:} First-Order Gradient Supervision with Learning-based Graph
               for Traffic Flow Forecasting},
  booktitle = {Proceedings of the Thirty-First International Joint Conference on
               Artificial Intelligence, {IJCAI} 2022, Vienna, Austria, 23-29 July
               2022},
  year      = {2022}
}