Skip to content

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Retail Sales Forecasting

This project forecasts future retail store sales using historical transactional data and Amazon Web Services (AWS) Forecast, a fully managed service that uses machine learning to deliver highly accurate time-series forecasts. It involves a full data pipeline starting from data preprocessing, exploratory data analysis (EDA), feature engineering, and model training using AWS Forecast. The primary goal is to help retail businesses make informed decisions in areas like inventory management, supply chain optimization, seasonal promotions, and budget planning by anticipating customer demand trends. The implementation ensures scalability, cloud integration, and automation potential for real-world retail forecasting systems.


Table of Contents

  1. Project Overview
  2. Setup
  3. Data Preparation
  4. Exploratory Data Analysis
  5. AWS Forecast Integration
  6. File Structure
  7. Usage
  8. Contributing
  9. License
  10. Acknowledgements

1. Project Overview

The Retail Sales Forecasting project leverages historical sales data to predict future trends, aiding in better inventory planning, staffing, and promotions.
Tech stack: Python, Pandas, Matplotlib, Seaborn, Boto3, and AWS Forecast.


2. Setup

2.1 Clone the Repository

git clone https://github.com/yourusername/Retail_Sales_Forecasting.git
cd Retail_Sales_Forecasting

2.2 Set Up Virtual Environment

python -m venv myenv
myenv\Scripts\activate     

2.3 Install Dependencies

pip install pandas numpy matplotlib seaborn boto3 awscli

2.4 Configure AWS CLI

aws configure

Make sure your IAM role has access to S3, Forecast, and Forecast permissions.


3. Data Preparation

3.1 Place Raw Data

Place your CSV file in the data/ directory with the name:

data/Sales_data.csv

3.2 Run Preprocessing Script

cd scripts
python data_preprocessing.py

This will create:

data/processed_sales_data.csv

Sample content: timestamp, item_id, target_value


4. Exploratory Data Analysis

4.1 Launch Jupyter Notebook

cd ../notebook
jupyter notebook eda.ipynb

4.2 Open and Run the Notebook

Run all cells in eda.ipynb to visualize sales patterns and trends.


5. AWS Forecast Integration

5.1 Schema File (schema.json)

Create a file named schema.json:

{
  "Attributes": [
    {"AttributeName": "item_id", "AttributeType": "string"},
    {"AttributeName": "timestamp", "AttributeType": "timestamp"},
    {"AttributeName": "target_value", "AttributeType": "float"}
  ]
}

5.2 Create Dataset

aws forecast create-dataset \
  --dataset-name retail_sales \
  --domain RETAIL \
  --dataset-type TARGET_TIME_SERIES \
  --data-frequency "D" \
  --schema file://schema.json \
  --region your-region

5.3 Create Dataset Import Job

aws forecast create-dataset-import-job \
  --dataset-import-job-name retail_sales_import \
  --dataset-arn your-dataset-arn \
  --data-source '{"S3Config":{"Path":"s3://your-bucket-name/processed_sales_data.csv","RoleArn":"your-iam-role-arn"}}' \
  --timestamp-format "yyyy-MM-dd" \
  --region your-region

Replace:

  • your-dataset-arn
  • your-bucket-name
  • your-iam-role-arn
  • your-region

6. File Structure

Retail_Sales_Forecasting/
├── data/
│   ├── Sales_data.csv
│   └── processed_sales_data.csv
├── myenv/
├── notebook/
│   └── eda.ipynb
├── scripts/
│   ├── data_preprocessing.py
│   └── forecast_integration.py
├── schema.json
└── README.md

7. Usage Summary

  1. Clone repository and set up environment
  2. Add raw CSV data to data/
  3. Run preprocessing script
  4. Explore data with Jupyter notebook
  5. Upload to AWS Forecast and generate predictions

8. Contributing

8.1 Fork & Clone

git fork https://github.com/Subratkb02/Retail_Sales_Forecasting_using_AWS-forecast.git
git clone https://github.com/Subratkb02/Retail_Sales_Forecasting_using_AWS-forecast.git

8.2 Create Feature Branch

git checkout -b feature/YourFeature

8.3 Commit & Push

git commit -m "Add new feature"
git push origin feature/YourFeature

8.4 Submit Pull Request

Open a PR from your fork to the main repository.


9. License

This project is licensed under the MIT License.


10. Acknowledgements

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages