This project is focused on predicting Walmart weekly sales based on several factors such as temperature, fuel price, CPI (Consumer Price Index), and unemployment rate, with the goal of aiding Walmart and other retail organizations in inventory planning, sales forecasting, and market analysis. The dataset used in this project contains sales data over several weeks, for various stores, along with external factors like holidays, weather conditions, and economic indicators.
- Data Loading: The dataset is loaded using Pandas from a CSV file, containing 6,435 entries and 8 columns, including features like weekly sales, temperature, fuel price, and unemployment rate.
- Data Preprocessing: The dataset undergoes several preprocessing steps including date parsing, feature engineering (extracting month and year from the Date), and scaling using MinMaxScaler.
- Exploratory Data Analysis (EDA): Visualizations such as line plots, scatter plots, heatmaps, and histograms are created to analyze the relationships between variables and trends over time.
- Model Training: A variety of regression models, including Linear Regression, Ridge Regression, XGBoost, Random Forest, AdaBoost, Gradient Boosting, and Bagging, are used to predict weekly sales.
- Evaluation: The models are evaluated using R2 score and Mean Squared Error (MSE), with XGBoost achieving the highest R2 score of 0.96.
- Retail Sales Forecasting: By predicting sales trends based on external factors, businesses can optimize inventory management, reduce stockouts, and improve customer satisfaction.
- Economic Analysis: Understanding the impact of economic indicators such as CPI and unemployment on retail sales can help companies adjust pricing strategies and promotions.
- Holiday and Seasonal Planning: Accurate sales predictions during holidays and peak seasons can support better staffing and promotional efforts.
To run this project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/BhaveshBhakta/Walmart-Sales-Prediction-Using-ML.git cd Walmart-Sales-Prediction-Using-ML
-
Run the Jupyter notebook:
Contributions are welcome! Feel free to fork the repository, make improvements, and submit a pull request.