Featured AI / ML Project & Architecture Demo

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.

Connecting...
Connecting to FastAPI microservice... Detecting server availability and warming up serverless instance (up to 8s).
Synthetic Demonstration Dataset: All transactional numbers, locations, and pricing curves were synthetically generated via a deterministic Python generator (Seed 42) for portfolio technical demonstration. No proprietary client data is utilized.

Evaluation Metrics

Synthetic Data

*Note: High performance scores (e.g. R² ≈ 0.97) are expected on generated data where underlying rules are mathematically deterministic.

Mean Absolute Error (MAE)
±8.51
Units per product line on held-out test data
Coefficient of Determination (R²)
0.9718
97.2% of demand variance explained by model
Root Mean Squared Error (RMSE)
13.10
Penalizes large outlier forecast errors
Mean Abs Percentage Error (MAPE)
7.23%
High forecast accuracy across retail volume

Forecast Scenario Controls Real-time inference

Model Prediction Output

Predicted Daily Demand
263.7
Empirical 95% Prediction Interval: [233.9 – 288.5 units] (held-out residuals: [−29.83, +24.78])
Effective Unit Price
$42.49
Projected Revenue
$11,204.61
Inference: 1.2 ms (Local calculation) ● Pipeline Ready

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).

Apparel · Store A (Urban Flagship)

Model Feature Weights

Relative feature importances extracted from the trained GradientBoostingRegressor pipeline.

Architecture Pipeline

  1. 1

    Synthetic Feature Engineering (Pandas)

    Generates multi-store transaction history with seasonal cyclicality, price elasticity, and promotional interaction effects.

  2. 2

    ML Preprocessing & Regressor (scikit-learn)

    Integrated ColumnTransformer with One-Hot encoding for store/category dimensions and StandardScaler into GradientBoostingRegressor.

  3. 3

    Asynchronous Microservice (FastAPI & Pydantic)

    Strict schema validation, bounded slider limits, CORS middleware, and sub-10ms inference latencies on modern hardware.

  4. 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.