# ML-Based Pain Recognition Model Using Mixup Data Augmentation
## 4 Results
### Leave-One-Subject-Out Cross-Validation (LOSOCV)  
Cross-validation is a technique used to train and test machine learning models. In cross-validation, the machine learning model is trained on a subset of data points and tested with the remaining data. and this is repeated in a loop for n times, n being the number of cross folds. A common approach when multiple subjects are involved is to use leave-one-subject-out cross-validation (LOSOCV). LOSOCV involves iterating through each subject in a dataset of n subjects. During each iteration, one subject is left out as a test set while the model is trained on the remaining n-1 subjects. This process is repeated until  
Figure 6: Machine learning model for pain recognition.  
all subjects have been used as test sets exactly once. When a subject is dropped out, all observations from the subject are left out of the training set. In our work, the value of n was 87, since we had 87 subjects involved in the experiment.  
The pain recognition model with mixup performed better in this experimental setup than the model without mixup. Mixup was performed using Equations (1) and (2), as mentioned in [11], where (\(x_{i}\),\(y_{i}\)) and (\(x_{j}\), \(y_{j}\)) are two samples drawn at random from the extracted features and \(\lambda\in[0,1]\). The \(\lambda\) values are sampled from the Beta distribution.  
The Beta distribution is utilized because it effectively models random variables that are constrained within a specific range, typically between 0 and 1, making it suitable for representing probabilities. Its shape parameter, alpha, often shows a pronounced peak near the extremes of 0 or 1. This indicates a high likelihood of observing values close to these limits, suggesting a strong tendency toward extreme outcomes, where the data sample is categorized as one class. Meanwhile, the distribution maintains variability within the range, with a somewhat constant probability of selecting values in the middle (0.33 as likely as 0.5, for instance). This implies that while extreme outcomes are more probable, values closer to the center are still feasible. The parameter \(\alpha\in[0.1,0.4]\) leads to improved performance; a smaller \(\alpha\) creates less of a mixup effect, whereas, for a larger \(\alpha\), mixup leads to underfitting.  
A performance evaluation based on the average accuracy of the designed architectures in a binary classification task consisting of the discrimination between the baseline temperature BL1 and the pain tolerance temperature PA4 is reported in Table 1.  
At a glance, the designed models with mixup performed better than the models without mixup. The average accuracy of the classical machine learning model trained as a binary classifier was 74.61% without mixup data augmentation. However, when the data were augmented with mixup, the performance was found to be better. \(\lambda\) is the hyperparameter that can be tuned, where \(\lambda\in[0,1]\); further, \(\lambda\) is sampled from the Beta distribution. The classifier was trained with different values of \(\alpha\), and the performance of the classical machine learning model was best when \(\alpha\) = 0.1, where the average accuracy of the pain recognition model was observed to be 75.87%.