GitHunt
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

  1. Clone the repository
git clone https://github.com/JayDS22/transportation-demand-forecasting.git
cd transportation-demand-forecasting
  1. Install dependencies
pip install -r requirements.txt
  1. Run the training pipeline
python src/train.py --config config/train_config.yaml
  1. 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 prediction
  • POST /batch_predict - Batch predictions
  • GET /model_info - Model metadata
  • GET /health - Health check