## 4 Methodology
### Implementation of the Models  
The boosting techniques that are based on an ensemble of weak predictive models allow the implementation of very accurate predictive models characterized by a small error from the comparison between real and predicted values [23; 38]. In the present study, two different models based, respectively, on GB and XGBoost, are implemented and compared, with the aim of forecasting the daily orders of the various products in each branch of the company involved in the research project. The models have been trained using historical sales data. The training process leads to the generation of a model created for a specific objective. The first step is the definition of the target that consists of a careful analysis of the input data, in which the input variables and the output target variable of the model are identified. In this phase, supervised training takes place; in fact, the algorithms process examples consisting of pairs of inputs and outputs. During this procedure, the relationship that links the input variables with the output variable is extrapolated, and a model is created capable of processing new system inputs by automatically generating forecasts on the output values. Item Code, Ordered Quantity, Customer Code and Branch Code have been chosen as input variables. Additionally, Date is the output variable, which will be linked to the predicted quantity. For each branch, a file containing historical data has been generated (sales point) and two customized regression models have been created, which will be invoked in the prediction phase of a given order so as to evaluate the predictive behavior with respect to real behavior. The regression predictive models, GB regressor (GBR) and XGBoost regressor (XGBR), are able to predict the quantity of a product that will be sold in each branch in the next 7 days, provided a sufficiently rich number of historical data are available. In case the dataset is poor, it is possible to use the Augmented Data technique already used in [21; 39] to enrich insufficient data. In fact, in addition to the quality of the data, the quantity of data is also a factor that affects the method precision. The available data have been used to build datasets for each branch. In order to prevent the overfitting, a cross-validation technique has been also applied, so that 80% of the data have been used to build the corresponding training dataset, and the remaining 20% has been adopted as a testing dataset useful for model validation. The data selection is random, by selecting 80% of each product sold in each branch. During the training, the model learns to correlate the various features and becomes able to generalize and, therefore, to predict the quantity of product sold when new data, different from the training data, are provided as input. Python programming language has been used to implement the GBR and the XGBoost algorithms. This language has been chosen because it provides very powerful open-source tools and libraries, such as scikit-learn and XGBoost. In particular, the XGBRegressor and GridSearchCV classes of scikit-learn have been used for implementing the XGBo model. GridSearchCV is a fundamental class for automatically obtaining an accurate prediction, as it allows an optimal choice of the hyperparameters to be made, which improves the computational efficiency and the prediction accuracy of the model [21; 40]. The main tunable XGBoost parameters are learning_rate, which is denoted by eta, n_estimators, max_depth, colsample_bytes, gamma, min_child_weight, alpha and lambda [41; 42; 43]. Eta is the learning rate and affects how quickly the model fits the residual error. N_estimators indicates the number of decision trees of the model. Max_depth denotes the maximum depth of a tree. Colsample_bytes refers to the features fraction that is sampled for constructing each tree. Gamma states exactly the minimum loss reduction that is required to make a node split. Min_child_weight determines the minimum sum of weights of all observations that is required in a child.