Learn how to forecast Walmart's weekly sales using Machine Learning models such as linear regression, decision tree, and ensemble models. Explore the dataset, perform EDA, feature engineering, and data preparation using Pandas, Numpy, Matplotlib, Seaborn, and Plotly. Evaluate models using WMAE and select the best model with hyperparameter tuning. Save the best model and summarize insights and learning. Open in Google Colab and click "Run" to execute the code.
Open in Google Colab and click the "Run" button to execute the code.
Walmart is an American Retail, Wholesale and E-commerce business. Sam Walton founded Walmart in 1962 in Rogers, Arkansas. His goal was to help people "Save Money and Live Better" which continues to be Walmart's guiding mission with "Every Day Low Prices(EDLC)" and great service.
Revenue and operations of the company are categorised into three key business segments - Walmart US, Walmart International and Sam's Club.
They operate in three store types or store formats as below.
The business problem is to forecast weekly store sales for Walmart.
Evaluation criteria and loss functions
WMAE - weighted mean absolute error
\[WMAE = \frac{1}{\Sigma w_i} * \sum_{i=1}^{+n} w_i * | y_i - \hat{y}_i|\]
where
n is the number of rows
\( \hat{y}_i \) is the predicted sales
\( y_i \) is the actual sales
\( w_i \) are weights. w = 5 if the week is a holiday week, 1 otherwise
In this notebook we will explore Supervised Machine Learning methods. Regression models such as linear regression, decision tree and ensemble models such as RandomForest, XGBoost, LightGBM will trained to predict weekly sales using Scikit Learn, LightGBM and XGBoost. We will use Pandas, Numpy, Matplotlib, Seaborn and Plotly to perform exploratory data analysis and gather insights for machine learning. We will do the following