This is a PyTorch implementation of Pattern-Matching Dynamic Memory Network for Dual-Mode Traffic Prediction
-
configs: training Configs and model configs for each dataset
-
lib: contains self-defined modules for our work, such as data loading, data pre-process, normalization, and evaluate metrics.
-
model: implementation of our model
-
data: contains relevant datasets
Python 3.6.5, Pytorch 1.9.0, Numpy 1.16.3, argparse and configparser
For convenience, we package these datasets used in our model in Google Drive.
Unzip the downloaded dataset files into the data
folder.
python run.py --datasets {DATASET_NAME} --type {MODEL_TYPE} --mode {MODE_NAME}
Replace {DATASET_NAME}
with one of datasets.
such as python run.py --dataset NYC-Taxi16
To run PM-DMNet with the desired configuration, set the type
parameter accordingly:
- Set
type P
to run PM-DMNet(P). - Set
type R
to run PM-DMNet(R).
There are two options for {MODE_NAME}
: train
and test
Selecting train
will retrain the model and save the trained model parameters and records in the experiment
folder.
With test
selected, run.py will import the trained model parameters from {DATASET_NAME}.pth
in the 'pre-trained' folder.
Here is an example of how to run the script using the specified parameters:
python run.py --dataset PEMSD8 --type P --mode train