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.
- Project Overview
- Setup
- Data Preparation
- Exploratory Data Analysis
- AWS Forecast Integration
- File Structure
- Usage
- Contributing
- License
- Acknowledgements
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.
git clone https://github.com/yourusername/Retail_Sales_Forecasting.git
cd Retail_Sales_Forecastingpython -m venv myenv
myenv\Scripts\activate pip install pandas numpy matplotlib seaborn boto3 awscliaws configureMake sure your IAM role has access to S3, Forecast, and Forecast permissions.
Place your CSV file in the data/ directory with the name:
data/Sales_data.csv
cd scripts
python data_preprocessing.pyThis will create:
data/processed_sales_data.csv
Sample content:
timestamp, item_id, target_value
cd ../notebook
jupyter notebook eda.ipynbRun all cells in eda.ipynb to visualize sales patterns and trends.
Create a file named schema.json:
{
"Attributes": [
{"AttributeName": "item_id", "AttributeType": "string"},
{"AttributeName": "timestamp", "AttributeType": "timestamp"},
{"AttributeName": "target_value", "AttributeType": "float"}
]
}aws forecast create-dataset \
--dataset-name retail_sales \
--domain RETAIL \
--dataset-type TARGET_TIME_SERIES \
--data-frequency "D" \
--schema file://schema.json \
--region your-regionaws 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-regionReplace:
your-dataset-arnyour-bucket-nameyour-iam-role-arnyour-region
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
- Clone repository and set up environment
- Add raw CSV data to
data/ - Run preprocessing script
- Explore data with Jupyter notebook
- Upload to AWS Forecast and generate predictions
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.gitgit checkout -b feature/YourFeaturegit commit -m "Add new feature"
git push origin feature/YourFeatureOpen a PR from your fork to the main repository.
This project is licensed under the MIT License.