Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ghfri-code/Sales-Forecasting

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
11 Commits
 
 
 
 
 
 

Repository files navigation

🧭 Sales Forecasting & Rolling Holt-Winters (Rossmann Case Study)

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.


📊 Project Overview

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.

🧠 Key Features

  • 📈 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) %
    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).


🧩 Project Structure

📁 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

⚙️ Installation & Setup

  1. Clone this repository

    git clone https://github.com/ghfri-code/Sales-Forecasting.git
    cd Sales-Forecasting
  2. Install dependencies

    pip install -r requirements.txt
  3. Add dataset
    Download the Rossmann Store Sales dataset and place it under:

    data/rossmann/train.csv
    data/rossmann/store.csv
    
  4. Run the notebook

    jupyter notebook Sales_Forecasting.ipynb

📈 Example Visualizations

  • 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

🧮 Forecasting Process

  1. Data Preparation: Load and merge datasets; handle missing days and promotions
  2. Trend & Seasonality Detection: Auto-detect seasonal period using ACF and seasonal_decompose
  3. Forecast Generation: Apply both rolling and direct Holt-Winters forecasting (statsmodels.tsa.holtwinters.ExponentialSmoothing)
  4. Model Evaluation: Compute RMSE, MAE, MAPE, and R² for comparison
  5. Visualization & Reporting: Save forecast plot as PNG and generate PDF summary report

🧰 Tech Stack

  • Python 🐍
  • pandas, numpy, matplotlib, seaborn – data handling & visualization
  • statsmodels – time series modeling (Holt-Winters)
  • scikit-learn – evaluation metrics
  • fpdf – PDF report generation

📜 Requirements

pandas
numpy
matplotlib
statsmodels
scikit-learn
fpdf

🚀 Future Improvements

  • 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)

About

End-to-end sales forecasting using Holt-Winters exponential smoothing with automated trend detection, rolling & direct predictions, and PDF reporting.

Topics

Resources

Stars

Watchers

Forks

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.