## 3 Materials and Methods
### Machine Learning Methodology
This leads to the soft-margin SVM formulation:  
\[\underset{w,b,\ \xi}{min}\ \frac{1}{2}\ \|\ w\ \|^{2}+C\sum_{i=1}^{n}\xi i, \ \text{subject to}\ y_{i}\ (w\cdot x_{i}\ +\ b)\ \geq\ 1\ -\ \xi_{i}\ \text{and}\ \xi_{i}\ \geq\ 0\]where \(\xi j\) are the slack variables, and \(C\) is the regularisation parameter that controls the trade-off between maximising the margin and minimising classification errors. In cases where the data are not linearly separable, SVMs use kernel functions to map the data into a higher-dimensional space where a linear separation is possible. The choice of kernel function and the tuning of parameters are critical to achieving good performance with SVMs. When choosing a classification method, it is important to consider the specific characteristics of the data, the nature of the problem, and the available computational resources. Therefore, before applying a particular method, detailed data analysis and experimentation is necessary to evaluate the effectiveness of each model in the context of the given task. In the present study, the development of the model was carried out using Matlab R2024a, specifically using the Classification Learner app to facilitate the process. To assess the performance of the models, the k-fold cross-validation method was used, where the dataset is divided into five folds. In this approach, the entire dataset is divided into five equal subsets, with each subset used once as the test set and the remaining subsets forming the training set. This process ensures that every data point is used for validation, providing a comprehensive evaluation of the model's performance. In the case of the Bagged Trees model, several configurations were tested to capture differences between classes. Parameters such as the number of trees, tree depth, and voting methods were varied to determine their effect on model performance. In addition, the choice of splitting criteria--whether information gain or the Gini index--played a key role in the decision-making process for splitting nodes in the trees. The Gini index is determined as follows (5):  
\[Q_{G}(m)=\sum_{j=1}^{s}p_{mi}(1-p_{mi})=1-\sum_{j=1}^{s}p_{mi}^{2} \tag{5}\]  
where \(p_{mi}\) is a conditional probability for the \(j\)-th class in a node, \(s\)--several classes. In node \(m\) with \(n_{m}\) observations, the conditional probability for the \(j\)-th class is equal to the following (6):  
\[p_{mi}=\frac{\#\{y=c_{i}:x\in R_{m}\}}{n_{m}} \tag{6}\]  
The quality of the classification models was assessed using several key statistical measures. One of the primary metrics was the accuracy of the model (Equation (7)), calculated as the ratio of correctly classified instances (true positives, _TPs_, and true negatives, _TNs_) to the total number of instances (_TPs_ + _TNs_ + false positives, _FPs_ + false negatives, _FNs_). The confusion matrix provided a detailed breakdown of the classification results, including the values for _TPs_, _TNs_, _FPs_ and _FNs_, giving a clear picture of the types and frequency of classification errors. \[Accuracy=\frac{TP+TN}{TP+TN+FP+FN} \tag{7}\]  
In addition to the accuracy, the receiver operating characteristic (ROC) curve and the area under the curve (AUC) were used to assess the model's ability to discriminate between classes. These metrics are particularly useful for assessing how well the model performs in terms of sensitivity and specificity. The error rate (Equation (8)), which is the complement of accuracy, was used to express the percentage of cases that were incorrectly classified. \[Error\ Rate=1-Accuracy \tag{8}\]  
Analysis of these indicators provided a comprehensive profile of the performance of the model. This allowed an assessment of its effectiveness across several dimensions, including overall accuracy and its ability to accurately discriminate between different classes.