A comprehensive machine learning system for predicting transportation demand using LSTM networks, time-series analysis, and external regressors.
- MAPE: 2.8% - Mean Absolute Percentage Error
- Directional Accuracy: 89.3% - Trend prediction accuracy
- 34% improvement in forecast accuracy with external regressors
- AIC: 1,247, BIC: 1,298 - Statistical model fit metrics
- LSTM-based demand prediction
- Multivariate time-series modeling
- External regressors (weather, events, holidays)
- Seasonal decomposition and ARIMA modeling
- Granger causality testing
- Real-time prediction API
- Python 3.9+
- PyTorch for deep learning
- Statsmodels for time-series analysis
- Pandas & NumPy for data manipulation
- Scikit-learn for preprocessing
- FastAPI for API development
- Docker for containerization
transportation-demand-forecasting/
βββ src/
β βββ data/
β β βββ __init__.py
β β βββ data_loader.py
β β βββ preprocessor.py
β βββ models/
β β βββ __init__.py
β β βββ lstm_model.py
β β βββ arima_model.py
β β βββ ensemble_model.py
β βββ features/
β β βββ __init__.py
β β βββ external_features.py
β β βββ time_features.py
β βββ evaluation/
β β βββ __init__.py
β β βββ metrics.py
β βββ api/
β βββ __init__.py
β βββ main.py
βββ data/
β βββ raw/
β βββ processed/
β βββ external/
βββ notebooks/
β βββ 01_exploratory_analysis.ipynb
β βββ 02_feature_engineering.ipynb
β βββ 03_model_evaluation.ipynb
βββ tests/
βββ requirements.txt
βββ Dockerfile
βββ README.md
- Clone the repository
git clone https://github.com/JayDS22/transportation-demand-forecasting.git
cd transportation-demand-forecasting- Install dependencies
pip install -r requirements.txt- Run the training pipeline
python src/train.py --config config/train_config.yaml- Start the API server
uvicorn src.api.main:app --reload| Model | MAPE | MAE | RMSE | Directional Accuracy |
|---|---|---|---|---|
| LSTM | 2.8% | 12.4 | 18.7 | 89.3% |
| ARIMA | 4.1% | 18.2 | 25.3 | 82.1% |
| Ensemble | 2.6% | 11.8 | 17.2 | 91.2% |
- Granger Causality Test: p-value < 0.05 for weather features
- Augmented Dickey-Fuller Test: Stationarity confirmed
- Ljung-Box Test: No autocorrelation in residuals
POST /predict- Single predictionPOST /batch_predict- Batch predictionsGET /model_info- Model metadataGET /health- Health check