PythonFlaskRandom ForestPower BITime Series
Time Series Demand Forecasting
Industry-grade monthly demand forecasting pipeline across states, districts, and service types with Power BI dashboard integration.
R² = 0.892MAE: 1842RMSE: 5623
Live Repository Metrics:
★ 2 stars⑂ 0 forks👁 2 watchers
accuracy / pipeline benchmarks
Model R² Score89.2%
Error Reduction34%
Feature Coverage95%
languages distribution
Jupyter Notebook91.1%HTML3.2%CSS2.5%JavaScript2.0%Python1.1%Dockerfile0.1%
performance & dataset details
1,842Mean Absolute Errordown from 2,790
5,623Root MSEstable variance
ExpandingCV Fold Typeleakage-free walk forward
3-tierGranularitystate, district, service
problem
UIDAI services face fluctuating demand across geographies and service categories. Naive forecasting methods (moving averages) don't capture seasonal patterns or group-level heterogeneity, leading to resource misallocation.
approach
Built a leakage-free ML pipeline using time-series cross-validation with an expanding-window strategy - no future data leaks into training folds. Engineered lag features (1, 3, 6, 12 months) and group-level scaling for each state-district-service combination. Used Random Forest as the base model for its interpretability and robustness.
tech stack
PythonScikit-LearnPandasFlaskPower BIMatplotlibRender
results & metrics
- →R² of 0.892 on held-out test window (leakage-free)
- →MAE reduced to 1842.35 and RMSE to 5623.47 through lag feature engineering and group-level scaling
- →Flask web app with real-time prediction endpoint
- →Power BI dashboard for stakeholder-facing visualization
learnings
- 01Expanding-window CV is essential for time series - standard k-fold introduces leakage that inflates metrics substantially
- 02Group-level normalization before lag feature creation matters more than model complexity for heterogeneous demand data
- 03Power BI's DirectQuery mode works better than import mode for data that updates frequently