This repository, a fork of DCRNN, is my response to the challege of Traffic Management.
- Clone this repository.
- Place the test CSV file similar to the given
training.csv
in theinput
folder ingrab_data
folder. (grab_data/input/test.csv
) - Open the
dcrnn_config.yaml
with a text editor such as notepad++ and set the latest_timepoint as follows.
To predict the demand values just after the latest timepoint in the dataset:
latest_timepoint:
day_hour_min_option:
set_day_hour_min: false
To set timepoint "T" to day 61 22:30, for example, to predict demand at 22:45, 23:00, 23:15, 23:30, 23:45.
latest_timepoint:
day_hour_min_option:
set_day_hour_min: true
day: 61
hour: 22
min: 30
- Run
dcrnn_main.py
. The prediction output will be saved atgrab_data/output
.
Open dcrnn_config.yaml
and set test_only
to false.
The DCRNN methodology use both time-series and spatial dependency (relationship between geohash locations) to forecast future values.
- Refactor.
- Integrate separate modules into a single module.
- Adapt preprocessing and postprocessing to the data at Traffic Management. Compute the distances between geohash locations and generate adjacency matrix (1 for itself, 0 for far locations.)
- Sample 48 timeslots (4 x 12 slots of 15 mins: 3 hours just before "T", 3+3 hours 1 week prior to "T", and the first 3 hours in the historical 2 weeks) from the historical sequence of 2 weeks (1344 slots of 15 minutes).
- Linear cosine decay of learning rate.
- Python>=3.5.3
- scipy>=1.3.0
- numpy>=1.16.4
- pandas>=0.24.2
- pyyaml>=3.13
- tensorflow>=1.13.0
- geopy>=1.20.0
- python-geohash>=0.8.5
Dependency can be installed using the following command:
pip install -r requirements.txt
- DCRNN (https://github.com/liyaguang/DCRNN)\
- Yaguang Li, Rose Yu, Cyrus Shahabi, Yan Liu, Diffusion Convolutional Recurrent Neural Network: Data-Driven Traffic Forecasting, ICLR 2018.
- Linear Cosine Decay (https://www.tensorflow.org/api_docs/python/tf/train/linear_cosine_decay)