Giter Club home page Giter Club logo

tpb's Introduction

Cross-city Few-shot Traffic Forecasting via Traffic Pattern Bank

[CIKM 2023] In this repository, we presents the code of "Cross-city Few-shot Traffic Forecasting via Traffic Pattern Bank" (TPB).

TPB

Data

The data is in https://drive.google.com/drive/folders/1UrKTgR27YmP9PjJ-FWv4SCDH3zUxtc5R?usp=share_link. Please download it and save them in ./data

Environment

The code is implemented in pytorch 1.10.0, CUDA version 11.3, python 3.7.0.

pip install torch==1.10.0+cu113 -f https://download.pytorch.org/whl/torch_stable.html

Reproducibility

The default configs of the four datasets are set in ./config. To reproduce the result, please run following command:

bash train.sh

or run the experiment on specific dataset (PEMS-BAY as an example):

CUDA_VISIBLE_DEVICES=0 nohup python -u train.py  --config_file ./configs/config_pems.yaml > train_pems.out 2>&1 &

Pre-trained stuff

The pre-trained patch encoder and traffic pattern bank is contained in this repository. The pre-trained patch encoder is in ./save/pretrain_model and the traffic pattern bank is in ./pattern.

You can also pre-train and generate traffic pattern bank on your own by:

# Pre-train
python -u ./pretrain.py --test_dataset ${test_dataset} --data_list ${data_list}
wait
python -u ./patch_devide.py --test_dataset ${test_dataset} --data_list ${data_list}
wait
python -u ./pattern_clustering.py --data_list $data_list --test_dataset ${test_dataset} --sim ${sim} --K ${K}

${data_list} is the source data. For example, if you want to pre-train the encoder in Chengdu, METR-LA and PEMS-BAY, then ${data_list} is chengdu_metr_pems.

${test_dataset} is the dataset you want to build target data on. If you want to build target data on Shenzhen then the ${test_dataset} is shenzhen.

${sim} and ${K} are the clustering hyper-parameter. You can set them by your own.

tpb's People

Contributors

zhyliu00 avatar

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.