Skip to content
MetaST for WWW 2019
Python Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
scripts update readme Apr 28, 2019

MetaST (Meta-learning for Spatial-Temporal Prediction)


Source code of the paper Learning from Multiple Cities: A Meta-Learning Approach for Spatial-Temporal Prediction

If you find this repository useful in your research, please cite the following paper:

  title={Learning from Multiple Cities: A Meta-Learning Approach for Spatial-Temporal Prediction},
  author={Yao, Huaxiu and Liu, Yiding and Wei, Ying and Tang, Xianfeng and Li, Zhenhui},
  booktitle={the Web Conference 2019 (WWW'19)},


  • Taxi Data
    • NYC, Washington DC, Porto, Chicago, Boston
    • processed data is in './data/taxi'
  • Bike Data
    • NYC, Washington DC, Chicago
    • processed data is in './data/bike'
  • Environment PH Data
    • Midwest, Northeast, Pacific, South, Southwest, West
    • processed data is in './data/environment'


Please check the data and scripts/preprocessing, training and testing for more details.

First, construct folders named models, outputs, test_data

Data Preprocessing

This part is used to generate the sequential data for training.

python ./maml/ --filename=/A/B.npz --cluster_file=/cluster/A/cluster_B --save_filename=B_seq.npz

A can be replaced by the task (taxi, bike, environment), B can be replaced by the city (e.g., nyc, dc)


For training, please use:

python ./maml/ --cities=several cities --save_dir=./models --model_type=att_metatrain_mem8 --update_batch_size=128 --test_num_updates=5 --threshold=0 --mem_dim=8 --cluster_loss_weight=1e-4 --meta_lr=1e-5 --update_lr=1e-5 --iterations=20000 --gpu_id=0


For testing, please use:

python ./maml/ --city=chicago --save_dir=./models --output_dir=./outputs --model_type=att_metatrain_mem8 --test_model=model_3200 --test_days=3 --update_batch_size=128 --threshold=0 --meta_lr=1e-5 --update_lr=1e-5 --epochs=30 --gpu_id=0

Finally, run to get denormalized results

You can’t perform that action at this time.