Skip to content

Repository files navigation

🔮 Easy Predict — Walmart Sales Forecasting

An end-to-end machine learning web app that forecasts Walmart store weekly sales using a Random Forest Regressor, built with Streamlit.

⚠️ Note: The trained model file (best_model_.pkl) is not included in this repository due to its large size (~1.1 GB). Follow the Generate the Model section below to create it locally before running the app.


📸 App Pages

Page Description
📊 Dashboard KPI metrics, store/department filter, monthly trend & holiday impact
📈 EDA Distributions, time trends, heatmaps, outlier detection
🔮 Prediction Interactive 12-week sales forecast with Plotly charts
ℹ️ About Project summary and model info

📁 Project Structure

Easy Predict/
│
├── app.py                          # Streamlit web application
├── EasyPredict_Part1 - Copy.ipynb  # Data exploration & EDA
├── EasyPredict_Part2 - Copy.ipynb  # Model training & evaluation → generates best_model_.pkl
├── walmart_sales_cleaned.csv       # Cleaned Walmart sales dataset
├── requirements.txt                # Python dependencies
├── .gitignore                      # Excludes best_model_.pkl
└── README.md

🚀 Getting Started

1. Clone the repository

git clone https://github.com/harshpatel0000/easy-predict.git
cd easy-predict

2. Install dependencies

pip install -r requirements.txt

3. Generate the model

The app requires best_model_.pkl to run. Open and run all cells in:

EasyPredict_Part2 - Copy.ipynb

This notebook will:

  • Load and preprocess walmart_sales_cleaned.csv
  • Train 4 models: Linear Regression, Decision Tree, Random Forest, Gradient Boosting
  • Automatically select the best model by R² score
  • Save it as best_model_.pkl in the same folder

4. Run the app

streamlit run app.py

Open http://localhost:8501 in your browser.


🤖 Model Details

Four regression models were trained and compared. The best model was selected automatically based on R² score.

Model Notes
Linear Regression Baseline
Decision Tree random_state=42
Random Forest n_estimators=100, max_depth=20, n_jobs=-1Best Model
Gradient Boosting random_state=42

Features used: Store, Dept, IsHoliday, Year, Month, Week
Target: Weekly_Sales


📊 Dataset

Based on the Walmart Store Sales Forecasting dataset from Kaggle, cleaned and preprocessed.

Key columns:

Column Description
Store / Store_Name Store identifier
Dept / Dept_Name Department identifier
Date Week of sales
Weekly_Sales Target — weekly revenue
IsHoliday Whether the week contains a public holiday

📦 Requirements

streamlit
pandas
numpy
matplotlib
seaborn
plotly
scikit-learn==1.6.1

Install with:

pip install -r requirements.txt

⚠️ Use scikit-learn==1.6.1 — the model was trained with this version. A different version may cause an InconsistentVersionWarning or incorrect predictions.


🛠️ Tech Stack

Layer Tools
Web App Streamlit
Visualization Plotly, Matplotlib, Seaborn
Machine Learning scikit-learn
Data Processing Pandas, NumPy
Language Python 3.11

📄 License

This project is open source and available under the MIT License.

About

A machine learning-based retail sales forecasting system using Python, Scikit-learn, and Streamlit to analyze historical data and predict future sales.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages