An open API service indexing awesome lists of open source software.

https://github.com/tuni56/demand-forecasting-system

Build predictive analytics solution for inventory management.
https://github.com/tuni56/demand-forecasting-system

aws-cloudwatch aws-dynamodb aws-lambda demand-forecasting forecasting-models prophet-model python

Last synced: 10 months ago
JSON representation

Build predictive analytics solution for inventory management.

Awesome Lists containing this project

README

          

# Demand Forecasting System

## 📌 Overview
This project implements a **Demand Forecasting System** using **Python, Facebook Prophet, and AWS Lambda** to predict inventory demand and optimize stock levels. The system helps businesses reduce inventory costs and improve forecast accuracy.

## 🎯 Business Impact
- ✅ **Reduced inventory costs by 30%**
- ✅ **Improved forecast accuracy by 40%**

## 🏗️ Architecture
The system follows a **serverless architecture** deployed on AWS:

1. **Data Ingestion**: Sales and inventory data are stored in **Amazon DynamoDB**.
2. **Prediction Model**: A forecasting model using **Facebook Prophet** processes the data.
3. **AWS Lambda Function**: Runs the Prophet model on-demand to generate predictions.
4. **CloudWatch Monitoring**: Logs execution details and errors.

## 🔧 Technologies Used
- **Python** 🐍 (Data processing & Model development)
- **Prophet** 📈 (Time-series forecasting)
- **AWS Lambda** ⚡ (Serverless execution)
- **DynamoDB** 🗄️ (NoSQL storage for historical and predicted data)
- **CloudWatch** 🔍 (Monitoring and logging)

## 🛠️ Installation & Setup
### 1️⃣ Clone the Repository
```bash
git clone https://github.com/yourusername/demand-forecasting-system.git
cd demand-forecasting-system
```

### 2️⃣ Create a Virtual Environment & Install Dependencies
```bash
python -m venv venv
source venv/bin/activate # (Mac/Linux)
venv\Scripts\activate # (Windows)
pip install -r requirements.txt
```

### 3️⃣ Run the Prophet Model (Local Testing)
```bash
python src/model.py
```

## 🚀 Deployment on AWS
- **Step 1:** Upload the model script to AWS Lambda.
- **Step 2:** Connect Lambda to DynamoDB.
- **Step 3:** Configure CloudWatch for monitoring.

## 📂 Project Structure
```
demand-forecasting-system/
├── data/ # Sample dataset (historical sales data)
├── src/ # Source code for model & AWS integration
│ ├── model.py # Prophet forecasting model
│ ├── lambda_function.py # AWS Lambda function script
│ ├── dynamodb.py # DynamoDB interaction script
├── requirements.txt # Dependencies
├── README.md # Documentation
```

## 📜 Prophet Model Implementation (src/model.py)
```python
import pandas as pd
from prophet import Prophet

# Load sample dataset
df = pd.read_csv('data/sales_data.csv')
df.rename(columns={'date': 'ds', 'sales': 'y'}, inplace=True)

# Initialize and fit the Prophet model
model = Prophet()
model.fit(df)

# Make future predictions
future = model.make_future_dataframe(periods=30)
forecast = model.predict(future)

# Save predictions
forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].to_csv('data/forecast.csv', index=False)
```

## 📌 Next Steps
- Implement DynamoDB integration.
- Deploy AWS Lambda function.
- Enable CloudWatch monitoring.

👨‍💻 **Contributions & Feedback are Welcome!** 🚀

⭐ **If you like this project, don't forget to give it a star!** ⭐