{"id":28140621,"url":"https://github.com/gaurav0502/daily-sales-forecasting","last_synced_at":"2026-04-20T03:04:47.322Z","repository":{"id":292466337,"uuid":"957657467","full_name":"Gaurav0502/daily-sales-forecasting","owner":"Gaurav0502","description":"Forecasting daily total sales 🧾 of different gifting items 🎁  using holiday data 🎄, promotional sales data 🏷️ , and other time-series features 🕛.","archived":false,"fork":false,"pushed_at":"2025-05-10T05:44:08.000Z","size":1966,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-10T06:27:09.624Z","etag":null,"topics":["deepar","forecasting","nhits","python","pytorch","ray","seaborn","temporal-fusion-transformer","tensorflow","tft"],"latest_commit_sha":null,"homepage":"","language":"Python","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/Gaurav0502.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","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}},"created_at":"2025-03-30T22:05:23.000Z","updated_at":"2025-05-10T05:44:11.000Z","dependencies_parsed_at":"2025-05-10T06:27:15.969Z","dependency_job_id":null,"html_url":"https://github.com/Gaurav0502/daily-sales-forecasting","commit_stats":null,"previous_names":["gaurav0502/daily-sales-forecasting"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gaurav0502%2Fdaily-sales-forecasting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gaurav0502%2Fdaily-sales-forecasting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gaurav0502%2Fdaily-sales-forecasting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gaurav0502%2Fdaily-sales-forecasting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gaurav0502","download_url":"https://codeload.github.com/Gaurav0502/daily-sales-forecasting/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254198452,"owners_count":22030966,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["deepar","forecasting","nhits","python","pytorch","ray","seaborn","temporal-fusion-transformer","tensorflow","tft"],"created_at":"2025-05-14T18:11:59.376Z","updated_at":"2026-04-20T03:04:47.316Z","avatar_url":"https://github.com/Gaurav0502.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003ch1\u003eDaily Sales Forecasting\u003c/h1\u003e\n\u003c/div\u003e\n\n## Aim\n\nTo forecast the daily sales of products with the holiday and promotional sales information. This information includes:\n\n1. Holiday Features (Christmas, is_weekend, is_holiday, days_to_christmas)\n\n2. Promotional Sales (Easter sale, Back to School sale, Black Friday sales, and Boxing Day sale)\n\n3. Time-series Features (7-day lag, 7-day rolling mean)\n\n## Environment Setup\n\n- Clone this repository.\n\n```bash\n\ngit clone https://github.com/Gaurav0502/daily-sales-forecasting.git\n\n```\n\n- Install all packages in the ```requirements.txt``` file.\n\n```bash\n\npip install -r requirements.txt\n\n```\n\n- Download and store all the three datasets from following sources:\n\n1. Online retail dataset: https://archive.ics.uci.edu/dataset/352/online+retail\n\n2. Clusters and Event dataset: https://www.kaggle.com/datasets/gauravpendharkar/cluster-and-events-data\n\n- The following directory structure is required for the code in this repository to work properly:\n\n```bash\n.\n├── data\n│   ├── clusters\n│   │   ├── cluster_0.csv\n│   │   ├── cluster_1.csv\n│   │   ├── cluster_2.csv\n│   │   ├── cluster_3.csv\n│   │   ├── cluster_4.csv\n│   │   ├── cluster_5.csv\n│   │   ├── cluster_6.csv\n│   │   ├── cluster_7.csv\n│   │   ├── cluster_8.csv\n│   │   └── cluster_9.csv\n│   ├── events.json\n│   └── online_retail_II.xlsx\n├── dataprocessor.py\n├── deepar\n│   ├── config.py\n│   └── deepar.py\n├── evaluator.py\n├── modelling.ipynb\n├── nhits\n│   ├── configs.py\n│   └── nhits.py\n├── README.md\n├── requirements.txt\n├── sales_holidays.py\n├── setup.sh\n├── tft\n│   ├── configs.py\n│   ├── tft.py\n│   └── tuner.py\n```\n- To use the code in this repository, use the following code snippet:\n  \n```python\n\n# custom data processor (can be modified as required)\nfrom dataprocessor import DataProcessor\n\n# custom model building and training\n# (works only if .py or .ipynb is in root directory of the project)\n\n# DeepAR\nfrom deepar.config import CrossValConfigs, DataSetConfigs, DeepARConfigs\nfrom deepar.deepar import DeepAR_model\n\n# NHiTS\nfrom nhits.config import CrossValConfigs, DataSetConfigs, OptimizerConfigs, NHiTSConfigs\nfrom nhits.nhits import NHiTS_model\n\n# TFT\nfrom tft.config import CrossValConfigs, DataSetConfigs, TFTConfigs\nfrom tft.tft import TFT\n\n# custom model evaluator\nfrom evaluator import Evaluator\n\n# data pre-processing\n# and feature engineering\ndp = DataProcessor(data_dir = \u003ccsv-dataset-file-path\u003e, clusters = \u003clist-of-clusters\u003e)\ndp.process()\ndata = dp.data\n\n# model training\n# (update accordingly for TFT or NHiTS)\ndeepar = DeepAR_model(\n    data = data,\n    configs = {\n        \"cross_validation\": CrossValConfigs(),\n        \"dataset\": DataSetConfigs(),\n        \"deepar\": DeepARConfigs()\n    }\n)\n\ndeepar.cross_validate(\n    MIN_TIME_IDX = data[\"time_idx\"].max() - 90,\n    MAX_TIME_IDX = data[\"time_idx\"].max()\n)\n\n# model evaluation\nevaluator = Evaluator(deepar.cv_results)\nevaluator.print_mape_summary()\nevaluator.forecast_error_by_region()\nevaluator.mape_by_forecast()\n\n```\n- Feel free to raise an issue if there any issues with the repository!\n  \n## Results\n\n\u003cdiv align=\"center\"\u003e\n\n| Model    | Overall MAPE     | Model Complexity    | Dashboard     |\n|--------------|--------------|--------------|--------------|\n| TFT | 21.70 | 0.2 | [wandb](https://wandb.ai/gauravpendharkar/TFT%20Window-based%20Evaluation?nw=nwusermitugaurav15) |\n| NHiTS | 18.70 | 0.2 | [wandb](https://wandb.ai/gauravpendharkar/NHiTS%20Window-based%20Evaluation/workspace?nw=nwusermitugaurav15) |\n| DeepAR | 19.51 | 0.2 | [wandb](https://wandb.ai/gauravpendharkar/DeepAR%20Window%20based%20evaluation/overview) |\n\u003c/div\u003e\n\nwhere:\n\n$$ \\text{Model Complexity} = \\frac{\\text{Number of Models}}{\\text{Number of Clusters}} $$\n\n## References\n\nOnline Retail dataset: https://archive.ics.uci.edu/dataset/502/online+retail+ii\n\nDemand Forecasting using TFT: https://pytorch-forecasting.readthedocs.io/en/stable/tutorials/stallion.html\n\nAutoregressive modelling with DeepAR and DeepVAR: https://pytorch-forecasting.readthedocs.io/en/stable/tutorials/deepar.html\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaurav0502%2Fdaily-sales-forecasting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgaurav0502%2Fdaily-sales-forecasting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaurav0502%2Fdaily-sales-forecasting/lists"}