Retail Demand Forecasting Microservice
An end-to-end machine learning system architected with FastAPI, scikit-learn, and Pandas. Predicts daily inventory demand with 95% confidence intervals based on price elasticity, promotion schedules, calendar seasonality, and ambient weather.
Evaluation Metrics
Synthetic Data*Note: High performance scores (e.g. R² ≈ 0.97) are expected on generated data where underlying rules are mathematically deterministic.
Forecast Scenario Controls Real-time inference
Model Prediction Output
30-Day Sales Demand Timeline
Historical sales volume versus Gradient Boosting model predictions with empirical 95% prediction intervals (2.5th–97.5th percentile held-out test residuals).
Model Feature Weights
Relative feature importances extracted from the trained GradientBoostingRegressor pipeline.
Architecture Pipeline
-
1
Synthetic Feature Engineering (Pandas)
Generates multi-store transaction history with seasonal cyclicality, price elasticity, and promotional interaction effects.
-
2
ML Preprocessing & Regressor (scikit-learn)
Integrated ColumnTransformer with One-Hot encoding for store/category dimensions and StandardScaler into GradientBoostingRegressor.
-
3
Asynchronous Microservice (FastAPI & Pydantic)
Strict schema validation, bounded slider limits, CORS middleware, and sub-10ms inference latencies on modern hardware.
-
4
Zero-Downtime Static Fallback Mode
Dual-mode client detects environment: runs live REST inference when connected, or falls back to precomputed data on GitHub Pages.