This project implements a daily demand forecasting system for a cafe to address issues of stock management and optimize inventory. By predicting product demand, the cafe aims to reduce instances of out-of-stock and over-stock situations, thereby minimizing wastage costs and maximizing profit.
The cafe is experiencing daily fluctuations in stock levels, leading to:
- Out-of-stock situations
- Over-stock situations
These issues result in increased wastage costs and decreased profits. The goal is to develop a daily demand forecasting model for the cafe's products to improve inventory management.
Below is a screenshot of the Prophet Forecasting App in action:
This image showcases the main features of our application:
- Future predictions chart for the next 28 days
- Model performance metrics (MAPE on test set)
- Forecast for a specific date
- Interactive elements for user input
- Data source: POS (Point of Sale) system
- Collection method: Web scraping using Octoparse
- Dataset: Approximately 100,000 customer bills (receipts)
- Data cleaning: Removal of unused columns, handling duplicates and null values
- Date/time formatting: Converting date strings to datetime objects
- Feature engineering:
- Extracting year, month, day, weekday
- Creating weekend indicator
- Calculating daily sales aggregates
The project includes various visualizations to understand sales patterns:
- Daily sales trend
- Monthly sales comparison
- Weekday vs. weekend sales
- Quantity vs. net sales scatter plot
- Gross profit margin over time
- Top 10 days by sales
The project uses Facebook's Prophet library for time series forecasting.
Key features:
- Incorporation of additional regressors (WeekDay, Is_Weekend)
- Model parameters tuning (changepoints, seasonality)
- Train-test split for model evaluation
- MAPE (Mean Absolute Percentage Error) calculation for model performance assessment
app.py: Streamlit web application for interactive forecastingmain.ipynb: Jupyter notebook containing data preparation, analysis, and modeling steps
- Install required dependencies:
pip install streamlit pandas numpy prophet sklearn plotly - Run the Streamlit app:
streamlit run app.py - Upload your CSV file containing sales data
- Adjust model parameters using the sidebar
- View forecasts and performance metrics
- Incorporate more external factors (e.g., weather, local events)
- Implement automated data collection from the POS system
- Develop a more sophisticated demand categorization system
- Integrate with inventory management system for real-time recommendations
[MD NASEIF]
[MIT]
