Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

USP-MoE

Addressing the Challenge of Spatiotemporal Data Scarcity:Cross-City Traffic Flow Prediction Guided by Urban Spatial Patterns

This paper proposes a cross-city traffic flow prediction method guided by urban spatial patterns, named USP-MoE.

Installation

Environment

  • Tested OS: Linux
  • Python >= 3.8
  • torch == 1.12.0
  • torch_geometric == 2.2.0
  • Tensorboard

Dependencies:

  1. Install Pytorch with the correct CUDA version.
  2. Use the pip install -r requirements.txt command to install all of the Python modules and packages used in this project.

Data

This project uses the original traffic flow data from the LargeST dataset(https://github.com/liuxu77/LargeST.). The dataset contains high-precision traffic flow records from multiple cities, covering both urban roads and county-level areas. It is well-suited for spatiotemporal traffic flow prediction, few-shot learning, and generative prediction model research.

For convenience, the data in this project has been divided by county, and the processed files are stored in the ./Data folder. Each county's data is stored as a separate file with a consistent format, making it easy to load and analyze.

Model Training

To train node-level models with the traffic dataset, run:

cd Pretrain

CUDA_VISIBLE_DEVICES=0 python pmain.py --taskmode task4 --model v_GWN --test_data metr-la --ifnewname 1 --aftername TrafficData

After full-trained, run Pretrain\PrepareParams\model2tensor.py to extract parameters from the trained model. And put the params-dataset in ./Data.

To train diffusion model and generate the parameters of the target city:

cd USP-MoE

CUDA_VISIBLE_DEVICES=0 python Umain.py --expIndex 140 --targetDataset metr-la --modeldim 512 --diffusionstep 500 --basemodel v_GWN --denoise Transmoe

The sample result is in USP-MoE/Output/expXX/.

Finetune and Evaluate

To finetune the generated parameters of the target city and evaluate, run:

cd Pretrain

CUDA_VISIBLE_DEVICES=0 python pmain.py --taskmode task7 --model v_GWN --test_data metr-la --ifnewname 1 --aftername finetune_7days --epochs 600 --target_days 7

Example

If you want to set 'Marin' as target city:

  • In pretrain: You need to merge the data from all counties except Marin to form the source city data, and use the merged source city data as test_data.
  • In Diffusion: set the targetDataset as 'Marin'.
  • In finetune: set the test_dataset as 'Marin'.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages