# Augmented Data and XGBoost Improvement for Sales Forecasting in the Large-Scale Retail Sector
## 3 Results and Discussion
RMSE value reported in the first row of Table 2, this is calculated by averaging the seven values of Figure 10. Each of these values refers to a different run in which the prediction was made for a given day in the week shown in Figure 10. \(MSE\) values were calculated using the same runs. We computed the values shown in Table 2 as follows:  
\[\overline{RMSE}=\frac{\sum_{i=1}^{7}(RMSE)_{i}}{7}\] \[\overline{MSE}=\frac{\sum_{i=1}^{7}(MSE)_{i}}{7}=\frac{\sum_{i=1}^ {7}(RMSE)_{i}^{2}}{7}\]  
where the subscript \(i\) refers to the \(i\)-th day of the week. When the model was trained by means of augmented data, the MSE improved by a factor of 10. As in [60], we studied the accuracy of the model as the hyperparameters vary. The study confirmed that the optimal values are those obtained using GridSearchCV, however in the present case there was not a significant increase in performance as the value of the hyperparameters varied. Table 3 shows the values of the main hyperparameters obtained automatically for the prediction shown in Figure 9d and a brief description of their meaning (for a more detailed description, see [41]). Finally, Figure 11 shows the Mean Square Error (MSE) obtained for the prediction, for the same product analyzed in the previous figures, as a function of the number of training days. The error had a minimum in the vicinity of 45 days. When the training took place over a very long period, i.e., over 120 days, the error grew as the products suffer the effect of seasonality and because the habits of customers can change over a long period. Moreover, other studies using other algorithms are oriented on the prediction of few days [61], thus confirming that there could be a lot of variables for long periods that cannot be controlled for the forecasting. In order to fully validate the model, we carried out further tests on other inventory items from different categories. The corresponding departments were the following:  
1. various foodstuffs (food and drinks, such as flour, pasta, rice, tomato sauce, biscuits, wine, vinegar, herbal teas, water, etc. );
2. delicatessen department (cured meats and dairy products);
3. fruit and vegetables (fresh fruit and vegetables, packaged vegetables);
4. bakery (bread, taralli, grated bread, bread sticks, etc. );
5. household products (napkins, handkerchiefs, toothpicks, shower gels, toothpaste, pet food, etc. ); \begin{table}
\begin{tabular}{c c c} \hline \hline
**Accuracy** & **Original Data** & **Augmented Data** \\ \hline RMSE & 0.63 & 0.28 \\ MSE & 0.93 & 0.092 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Accuracy results of the XGBoost model when trained with original or augmented data. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Hyperparameter** & **Value** & **Description ([41])** \\ \hline Eta (learning\_rate) & 0.1 & Learning rate \\ _n\_estimators_ & 175 & Number of estimators \\ Max\_depth & 2 & Maximum depth of the tree \\ Colsample\_bytree & 0.8 & Subsample ratio of columns for each tree \\ Min\_child\_weight & 1 & Minimum sum of weights in a child \\ Alpha & 0 & Regularization term on weights \\ Lambda & 1 & Regularization term on weights \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Value of the main hyperparameters for the run of Figure 9d and their descriptions. * frozen products (peas, minestrone, ice cream, etc. );
* refrigerator packaged products (fresh milk, butter, dairy products, cheeses, packaged, meats, etc.). Department 1 is the largest as it contains most of the food and drinks, so we chose various products from this department. In detail, the items chosen were:  
1. cream pack, flour pack, still water bottle, iodized sea salt pack;
2. mozzarella;
3. loose tomatoes;
4. bread;
5. paper towel;
6. frozen soup;
7. bottle of fresh milk, smoked scamorze. The implemented XGBoost algorithm predicts the quantity that will be sold in the selected period, which varies between 1 and 7 days.