{"id":50505402,"url":"https://github.com/shubham001official/fmcg-demand-forecasting","last_synced_at":"2026-06-02T15:30:59.333Z","repository":{"id":350857933,"uuid":"1208522498","full_name":"shubham001official/fmcg-demand-forecasting","owner":"shubham001official","description":"Transformer-based demand forecasting system with Streamlit dashboard and KPI insights. Time-series forecasting application using Amazon Chronos and PyTorch.","archived":false,"fork":false,"pushed_at":"2026-04-12T12:28:51.000Z","size":268,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-12T14:19:31.007Z","etag":null,"topics":["demand-forecasting","machine-learning","time-series-forecasting"],"latest_commit_sha":null,"homepage":"https://fmcg-demand-forecasting.streamlit.app","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shubham001official.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-12T11:59:40.000Z","updated_at":"2026-04-12T12:34:41.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/shubham001official/fmcg-demand-forecasting","commit_stats":null,"previous_names":["shubham001official/fmcg-demand-forecasting"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/shubham001official/fmcg-demand-forecasting","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubham001official%2Ffmcg-demand-forecasting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubham001official%2Ffmcg-demand-forecasting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubham001official%2Ffmcg-demand-forecasting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubham001official%2Ffmcg-demand-forecasting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shubham001official","download_url":"https://codeload.github.com/shubham001official/fmcg-demand-forecasting/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shubham001official%2Ffmcg-demand-forecasting/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33829340,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-02T02:00:07.132Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["demand-forecasting","machine-learning","time-series-forecasting"],"created_at":"2026-06-02T15:30:56.805Z","updated_at":"2026-06-02T15:30:59.311Z","avatar_url":"https://github.com/shubham001official.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"\r\n# FMCG Demand Intelligence Platform\r\n\r\n**Author:** Shubham Sharma\r\n\r\n---\r\n\r\n## Badges\r\n\r\n![Python](https://img.shields.io/badge/Python-3.10+-blue)\r\n![PyTorch](https://img.shields.io/badge/PyTorch-Enabled-red)\r\n![Streamlit](https://img.shields.io/badge/Streamlit-App-orange)\r\n![License](https://img.shields.io/badge/License-MIT-green)\r\n![Status](https://img.shields.io/badge/Status-Production--Ready-success)\r\n\r\n---\r\n\r\n## 1. Overview\r\n\r\nThis project implements a production-style **AI-driven demand forecasting system** for FMCG products using transformer-based time-series models.\r\n\r\nThe system leverages **Amazon Chronos (T5-based architecture)** to generate probabilistic forecasts and integrates a **Streamlit-based analytics layer** for visualization, decision support, and reporting.\r\n\r\nThe platform is designed to replicate real-world enterprise workflows used in:\r\n\r\n- Demand planning\r\n- Supply chain optimization\r\n- Retail analytics\r\n- Business intelligence systems\r\n\r\n---\r\n\r\n## 2. Key Capabilities\r\n\r\n### Forecasting Engine\r\n- Transformer-based forecasting using Chronos\r\n- Multi-product batch inference\r\n- Probabilistic outputs with uncertainty bounds\r\n- GPU-accelerated inference support\r\n\r\n### Data Engineering\r\n- Columnar storage using Parquet\r\n- High-performance processing with Polars\r\n- Memory optimization via categorical encoding\r\n\r\n### Analytics Layer\r\n- Interactive filtering (Company, Category, Product)\r\n- Time-window analysis (3M, 6M, 1Y, Full)\r\n- Multi-product comparative visualization\r\n\r\n### Evaluation Metrics\r\n- Mean Absolute Percentage Error (MAPE)\r\n- Root Mean Squared Error (RMSE)\r\n\r\n### Reporting\r\n- Automated PDF generation\r\n- Business-ready executive summaries\r\n- Embedded visualizations\r\n\r\n---\r\n\r\n## 3. System Architecture\r\n\r\n```mermaid\r\nflowchart LR\r\n    A[Raw Sales Data - Parquet] --\u003e B[Data Processing Layer]\r\n    B --\u003e C[Feature Extraction]\r\n    C --\u003e D[Chronos Forecast Model]\r\n    D --\u003e E[Forecast Samples]\r\n    E --\u003e F[Quantile Aggregation]\r\n    F --\u003e G[Master Dataset]\r\n    G --\u003e H[Streamlit Application]\r\n    H --\u003e I[Interactive Dashboard]\r\n    H --\u003e J[AI Insight Engine]\r\n    H --\u003e K[PDF Report Generator]\r\n````\r\n\r\n-----\r\n\r\n## 4\\. Detailed Pipeline Architecture\r\n\r\n```mermaid\r\nflowchart TD\r\n    subgraph Data_Layer [Data Layer]\r\n        A1[Historical FMCG Sales]\r\n        A2[Parquet Storage]\r\n    end\r\n\r\n    subgraph Processing_Layer [Processing Layer]\r\n        B1[Polars DataFrame]\r\n        B2[Filtering by Product Hierarchy]\r\n        B3[Sorting Time Series]\r\n    end\r\n\r\n    subgraph Model_Layer [Model Layer]\r\n        C1[Chronos T5 Model]\r\n        C2[Tensor Conversion]\r\n        C3[GPU Inference]\r\n    end\r\n\r\n    subgraph Forecast_Layer [Forecast Layer]\r\n        D1[Multiple Sample Paths]\r\n        D2[Median Forecast]\r\n        D3[Confidence Intervals]\r\n    end\r\n\r\n    subgraph Output_Layer [Output Layer]\r\n        E1[Historical + Forecast Merge]\r\n        E2[Schema Enforcement]\r\n        E3[Parquet Output]\r\n    end\r\n\r\n    subgraph Application_Layer [Application Layer]\r\n        F1[Streamlit UI]\r\n        F2[Plotly Visualizations]\r\n        F3[AI Insights]\r\n        F4[PDF Reports]\r\n    end\r\n\r\n    A1 --\u003e A2 --\u003e B1 --\u003e B2 --\u003e B3\r\n    B3 --\u003e C2 --\u003e C1 --\u003e C3\r\n    C3 --\u003e D1 --\u003e D2 --\u003e D3\r\n    D2 --\u003e E1\r\n    D3 --\u003e E1\r\n    E1 --\u003e E2 --\u003e E3 --\u003e F1\r\n    F1 --\u003e F2\r\n    F1 --\u003e F3\r\n    F1 --\u003e F4\r\n```\r\n\r\n-----\r\n\r\n## 5\\. Forecasting Methodology\r\n\r\n### Input\r\n\r\n  - Univariate time series per product (daily demand)\r\n\r\n### Model\r\n\r\n  - Chronos T5 small variant\r\n  - Pretrained transformer for time-series forecasting\r\n\r\n### Inference\r\n\r\n  - Generates multiple forecast trajectories (`num_samples=20`)\r\n\r\n### Aggregation\r\n\r\n  - Median used as final prediction\r\n  - 10th percentile → lower bound\r\n  - 90th percentile → upper bound\r\n\r\n### Post-processing\r\n\r\n  - Negative values clipped to zero\r\n  - Forecast horizon: 30 days\r\n\r\n-----\r\n\r\n## 6\\. Data Schema\r\n\r\n### Input Dataset\r\n\r\n| Column | Description |\r\n| :--- | :--- |\r\n| Date | Timestamp |\r\n| Company | FMCG company |\r\n| Category | Product category |\r\n| Product | SKU/Product name |\r\n| Demand | Units sold |\r\n\r\n### Output Dataset\r\n\r\n| Column | Description |\r\n| :--- | :--- |\r\n| Date | Timestamp |\r\n| Company | Company |\r\n| Category | Category |\r\n| Product | Product |\r\n| Data\\_Type | Historical / Forecast |\r\n| Demand | Predicted / Actual |\r\n| Demand\\_Lower | Lower bound |\r\n| Demand\\_Upper | Upper bound |\r\n\r\n-----\r\n\r\n## 7\\. Application Architecture\r\n\r\nThe Streamlit application is structured into modular components:\r\n\r\n  - Data loading (cached)\r\n  - Filtering layer (sidebar controls)\r\n  - KPI computation\r\n  - Forecast evaluation\r\n  - Visualization layer\r\n  - AI insights engine\r\n  - Report generation module\r\n\r\n-----\r\n\r\n## 8\\. Dashboard Features\r\n\r\n### Overview Tab\r\n\r\n  - Recent demand metrics\r\n  - Growth rate computation\r\n  - Forecast totals\r\n  - Moving average trends\r\n\r\n### AI Insights Tab\r\n\r\n  - Rule-based interpretation of:\r\n      - Trend direction\r\n      - Growth signals\r\n      - Forecast reliability\r\n\r\n### Forecast Tab\r\n\r\n  - Actual vs predicted comparison\r\n  - Error metrics visualization\r\n\r\n### Multi-Product Analysis\r\n\r\n  - Cross-product demand comparison\r\n  - Contribution analysis\r\n\r\n-----\r\n\r\n## 9\\. Performance Considerations\r\n\r\n  - **Polars** significantly improves query performance over pandas.\r\n  - **GPU inference** reduces forecasting latency.\r\n  - **Columnar storage** (Parquet) minimizes I/O overhead.\r\n  - **Categorical encoding** reduces memory footprint.\r\n\r\n-----\r\n\r\n## 10\\. Project Structure\r\n\r\n```text\r\nfmcg-demand-ai/\r\n├── fmcg_sales_india_2023_2026.parquet\r\n├── fmcg_master_forecast.parquet\r\n├── app.py\r\n├── training.py\r\n├── Screenshots/\r\n│   └── app.png\r\n├── requirements.txt\r\n└── README.md\r\n```\r\n\r\n-----\r\n\r\n## 11\\. Setup Instructions\r\n\r\n### Install Dependencies\r\n\r\n```bash\r\npip install pandas polars torch transformers tqdm streamlit plotly reportlab\r\npip install git+[https://github.com/amazon-science/chronos-forecasting.git](https://github.com/amazon-science/chronos-forecasting.git)\r\n```\r\n\r\n### Run Forecast Pipeline\r\n\r\n```bash\r\npython training.ipynb\r\n```\r\n\r\n### Launch Application\r\n\r\n```bash\r\nstreamlit run app.py\r\n```\r\n\r\n-----\r\n\r\n## 12\\. Screenshot\r\n\u003cp align=\"center\"\u003e\r\n  \u003cimg src=\"Screenshots/app.png\" alt=\"App Screenshot\" width=\"600\"/\u003e\r\n\u003c/p\u003e\r\n\r\n-----\r\n\r\n## 13\\. Future Enhancements\r\n\r\n  - Real-time data ingestion pipelines\r\n  - Model fine-tuning on domain-specific data\r\n  - Hierarchical forecasting (Company → Category → SKU)\r\n  - Integration with inventory optimization systems\r\n  - Deployment on cloud infrastructure (AWS / GCP)\r\n\r\n-----\r\n\r\n## 14\\. License\r\n\r\nThis project is licensed under the MIT License.\r\n\r\n```text\r\nMIT License\r\nCopyright (c) 2026 Shubham Sharma\r\n...\r\n```\r\n\r\n-----\r\n\r\n## 15\\. Author\r\n\r\n**Shubham Sharma**\r\n\r\n**GitHub**: [https://github.com/shubham001official](https://github.com/shubham001official)\r\n\r\n```\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshubham001official%2Ffmcg-demand-forecasting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshubham001official%2Ffmcg-demand-forecasting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshubham001official%2Ffmcg-demand-forecasting/lists"}