Predict traffic flow with LSTM
Switch branches/tags
Nothing to show
Clone or download
Latest commit bf9a8e2 Jul 19, 2018

README.md

LSTM Based Traffic Prediction

This project seeks to use LSTM for traffic prediction using the Keras frontend for Theano. Hyperparameter optimisation is used to find the best set of parameters for the network.

Usage

Run:

pip install -r requirements.txt

Then edit main.py so that it uses your own parameters for the network. It will attempt to store hyperparameter results in mongodb. You can use show_results.py to view them. Please keep in mind this for experimentation only and not appropriate for production.

Run using:

python main.pymain.py <steps eg. 1> </path/to/data.csv> <train_test_split eg. 0.75> <num_epochs eg. 10> <model_trials eg. 20>

The CSV should have a the following format:

timestamp,16,17,18,19,20,21
2011-12-31 23:55:00,4,6,8,13,3,0
2012-01-01 00:00:00,5,7,8,10,3,2
2012-01-01 00:05:00,3,3,7,15,1,2
2012-01-01 00:10:00,9,3,3,7,1,1
2012-01-01 00:15:00,3,4,12,15,2,0
2012-01-01 00:20:00,7,5,11,19,2,2

Basically, the first column must be a timestamp and the rest integer values.

Scripts are also provided to speed up processing via Sun Grid Engine. Though they are unreliable because of the length of time it takes for theano to compile the models. You will also need CUDA and a compatible card if you want the speedups they provide.