## 2 Materials and Methods
### Clustering Algorithm
#### 2.4.2 Supervised Algorithms
This process is repeated recursively for each subset until some stopping criterion is met, such as reaching a maximum depth level or being unable to perform further splits. The decision tree formulation involves finding the best feature and cutoff point to split the dataset at each node. This is achieved by applying impurity metrics, such as information gain or Gini impurity. These metrics evaluate how well the classes or categories are separated into the generated subsets [40,41]. The tree is built from top to bottom, each time dividing the dataset into more homogeneous subsets. In the context of regression, a decision tree seeks to partition the feature space such that the sum of squared errors within each terminal node is minimized (Equation (10)). \[H(X,f)=\sum_{j=1}^{\lvert X\rvert}\bigl{(}y_{j}-f(X_{j})\bigr{)}^{2} \tag{10}\]  
such that \(X\) represents the dataset, \(\lvert X\rvert\) represents the number of terminal nodes, \(y_{j}\) represents the values observed at the terminal node \(j\), and \(f(X_{j})\) signifies the model's prediction for the data at that node. Random Forest Regression  
Random forest is a machine learning algorithm that combines multiple decision trees to make decisions. Each tree \(T\) in the forest is trained on a random sample of the data (Equation (11)), and then the predictions of all trees are averaged to obtain a more robust and accurate final prediction (Equation (12)). The random forest algorithm starts by randomly selecting a sample of the training data. Then, a decision tree is constructed using this sample, but at each node, only a random subset of features is considered. This process is repeated several times to create multiple decision trees. To make predictions, the majority of votes from all trees are taken. This involves combining individual decision trees usingthe averaging or voting technique. In each tree, techniques such as information gain or Gini impurity are used to determine the optimal splits at the nodes [41; 42]. \[H_{T}(X,f)=\sum_{j=1}^{|X|_{T}}\bigl{(}y_{j}-f_{T}(X_{j})\bigr{)}^{2} \tag{11}\]  
\[f_{RF}(X)=\frac{1}{N}\sum_{i=1}^{N}f_{Ti}(X) \tag{12}\]  
such that \(X\) represents the dataset, \(|X|_{T}\) represents the number of terminal nodes in the tree \(T\), \(y_{j}\) represents the values observed at the terminal node \(j\), \(f_{T}(X_{j})\) represents the model's prediction of tree \(T\) for the data at that node, \(N\) represents the total number of trees in the forest, and \(i\) is used to iterate through each of the \(N\) trees in the forest. Thus, \(f_{Ti}(X)\) is the prediction of the \(i\)-th tree for the dataset \(X\). Gradient Boosting Regression  
Gradient boosting is a machine learning algorithm that combines multiple weak learning models to create a stronger and more accurate model. Unlike random forest, gradient boosting focuses on iteratively improving the errors of the previous model rather than working with different data samples. The gradient boosting algorithm builds an initial model, such as a simple decision tree, and then focuses on iteratively improving the model predictions. At each iteration, new models are fitted to the residual of the previous model's errors, attempting to reduce the overall error. The models are combined by weighted summation to obtain a final prediction. The gradient boosting formulation involves fitting these new models using the downward gradient. The gradient represents the direction and magnitude of the largest error growth, so the objective is to reduce it at each iteration by means of the mean square error or cross-entropy [43]. As with the previous methods, the objective is to minimize a loss function \(G\) (Equation (13)); therefore, \(g(y_{i},F(X_{i}))\) is called the individual loss function, and this is the difference between the true labels \(y_{i}\) and the predictions of the model \(F(X_{i})\) for each sample \(i\). In this case, \(F(X)\) represents the sum of the predictions of all trees \(h_{m}(X)\) up to that stage \(m\) (Equation (14)).