## 2 Materials and Methods
### Machine Learning Models  
The goal of our analysis was to compare the performance of three different machine learning models, Gradient Boosting (GB), Random Forest (RF), and XGBoost (XGB), to predict mortality for endocrine, nutritional, and metabolic diseases through geolocalized  
Figure 3: Application of a hierarchical clustering algorithm combined with a semivariogram plot of standardized mortality ratio rates. This integrated approach delineates three spatially contiguous communities, effectively addressing potential spatial data leakage.  
data. Furthermore, a linear regression model was trained to show how decision tree-based models perform better for this type of analysis than a simpler regression model.  
Gradient Boosting is an ensamble machine learning model that combines the strengths of multiple weak learners to create a stronger one. The algorithm works iteratively, where each subsequent model is trained to minimize the residual errors (i.e., the differences between predicted and actual values) of the preceding model using a gradient descent approach. By sequentially adding models, Gradient Boosting reduces bias and variance, improving overall performance. Hyperparameters such as the learning rate, maximum tree depth, and number of estimators play a critical role in controlling the model's complexity and preventing overfitting. We optimized the regression in cross-validation by varying the GB parameters, including the following:  
\[n\_estimators=\{100,150,200,250\}\] \[learning\_rate=\{0.1,0.2,0.3,0.04,0.05\}\] \[max\_depth=\{\text{None},3,5\}\]  
Random Forest regressor is an ensemble learning algorithm used for its robustness and ability to handle high-dimensional data. It operates by constructing a multitude of decision trees during training and combines their outputs to produce a final prediction through averaging. The algorithm introduces randomness by using bootstrapped samples of the data to train each tree and by selecting a random subset of features at each split. This approach reduces overfitting and improves generalization compared to individual decision trees. We improved regression performance during cross-validation by tuning the RF parameters, such as the following:  
\[n\_estimators=\{50,100,150,200,250,300\}\] \[max\_depth=\{\text{None},3,5\}\]  
XGBoost (Extreme Gradient Boosting) is a high-performance implementation of the Gradient Boosting algorithm and is designed to optimize both computational efficiency and predictive accuracy. XGBoost builds an ensemble of decision trees sequentially, where each tree aims to reduce the residual errors of its predecessors using a gradient descent method. Its enhancements include tree pruning, regularization terms in the loss function, and support for parallel and distributed computation, making it faster and more robust than traditional gradient boosting techniques. We enhanced the regression accuracy in cross-validation by adjusting the following XGB parameters:  
\[n\_estimators=\{100,150,200,250,300,350,400,450,500\}\] \[learning\_rate=\{0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1\}\] \[max\_depth=\{\text{None},3,5\}\]  
We evaluated the performance of the three machine models by computing the coefficient of determination \(r^{2}\), the mean absolute error \(MAE\), and the root mean squared error \(RMSE\):  
* Coefficient of determination: \[r^{2}=1-\frac{\sum_{i=1}^{n}(y_{i}-\hat{y}_{i})^{2}}{\sum_{i=1}^{n}(y_{i}-\hat {y})^{2}}\] (1)
* Mean absolute error: \[MAE=\frac{1}{n}\sum_{i=1}^{n}|(y_{i}-\hat{y}_{i})|\] (2)* Root mean squared error: \[RMSE=\sqrt{\frac{1}{n}\sum_{i=1}^{n}(y_{i}-\hat{y}_{i})^{2}}\] (3) where \(y_{i}\) are the observed values, \(\hat{y}_{i}\) are the predicted ones, and \(\bar{y}\) is their average value.