This project demonstrates time series forecasting using both rolling and direct prediction strategies based on the Holt-Winters Exponential Smoothing model. It applies to the Rossmann Store Sales dataset and includes data exploration, automatic trend & seasonality detection, forecast evaluation, and automated PDF reporting.
The main objective of this project is to:
- Analyze sales patterns at both company and store level.
- Detect trend and seasonality automatically.
- Perform rolling forecasts (iterative 7-day predictions) and direct forecasts (30-day batch predictions).
- Evaluate performance using multiple statistical metrics.
- Generate a PDF report summarizing results and metrics.
-
๐ Exploratory Data Analysis (EDA):
Includes visualizations of trends, seasonality, promotions, store types, and competition distance. -
๐ Time Series Analysis:
Automatically detects trend and seasonality using ACF and decomposition. -
๐ Forecasting Strategies:
- Rolling Forecast: Iterative 7-day forecast updated every cycle.
- Direct Forecast: One-time 30-day prediction.
Both trained using Holt-Winters Exponential Smoothing.
-
๐งฎ Performance Evaluation:
Results include both absolute and relative error metrics:Metric Description Unit RMSE Root Mean Squared Error Absolute Relative RMSE RMSE as % of mean actuals % MAE Mean Absolute Error Absolute Relative MAE MAE as % of mean actuals % MAPE Mean Absolute Percentage Error (Company-level only) % Rยฒ Coefficient of Determination - -
๐ Automated Reporting:
Creates clean, professional reports for both company and store forecasts, including daily forecasted values and performance summary. -
๐ฌ Store-Level Analysis:
Includes example forecasting for an individual store (Store ID = 1).
๐ data/
โโโ rossmann/
โ โโโ train.csv
โ โโโ store.csv
๐ report/
โโโ sales_forecast_report_company.pdf
โโโ sales_forecast_report_store1.pdf
โโโ forecast_comparison_company.png
๐ Sales_Forecasting.ipynb
๐ requirements.txt
๐ README.md
-
Clone this repository
git clone https://github.com/ghfri-code/Sales-Forecasting.git cd Sales-Forecasting -
Install dependencies
pip install -r requirements.txt
-
Add dataset
Download the Rossmann Store Sales dataset and place it under:data/rossmann/train.csv data/rossmann/store.csv -
Run the notebook
jupyter notebook Sales_Forecasting.ipynb
- Daily sales trend with a 30-day moving average
- Sales by day of week and monthly sales trend
- Top 10 stores by sales
- Promotion impact analysis
- Store type & competition distance analysis
- Data Preparation: Load and merge datasets; handle missing days and promotions
- Trend & Seasonality Detection: Auto-detect seasonal period using ACF and seasonal_decompose
- Forecast Generation:
Apply both rolling and direct Holt-Winters forecasting
(
statsmodels.tsa.holtwinters.ExponentialSmoothing) - Model Evaluation: Compute RMSE, MAE, MAPE, and Rยฒ for comparison
- Visualization & Reporting: Save forecast plot as PNG and generate PDF summary report
- Python ๐
- pandas, numpy, matplotlib, seaborn โ data handling & visualization
- statsmodels โ time series modeling (Holt-Winters)
- scikit-learn โ evaluation metrics
- fpdf โ PDF report generation
pandas
numpy
matplotlib
statsmodels
scikit-learn
fpdf
- Integrate Prophet and XGBoost for hybrid forecasts
- Add automated hyperparameter tuning for seasonal components
- Implement automated parameter tuning for seasonal periods
- Add interactive dashboards (Streamlit / Plotly)