JA
JayDS22/Transportation_And_Demand_Forecasting
๐ Advanced LSTM-based transportation demand forecasting achieving MAPE: 2.8% with multivariate time-series analysis โก Real-time prediction API with external regressors (weather, events) and statistical validation using Granger causality tests
Transportation Demand Forecasting System
A comprehensive machine learning system for predicting transportation demand using LSTM networks, time-series analysis, and external regressors.
๐ Key Results
- 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
๐ Features
- 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
๐ Tech Stack
- 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
๐ Project Structure
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
๐ Quick Start
- 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 Performance
| 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% |
๐ Statistical Tests
- Granger Causality Test: p-value < 0.05 for weather features
- Augmented Dickey-Fuller Test: Stationarity confirmed
- Ljung-Box Test: No autocorrelation in residuals
๐ API Endpoints
POST /predict- Single predictionPOST /batch_predict- Batch predictionsGET /model_info- Model metadataGET /health- Health check