## 2 Materials and Methods
### Analysis of Visible and Thermal Imaging Data
#### 2.4.4 Application of Supervised Machine Learning  
Firstly, a machine learning approach was utilized to predict SI relying on features extracted from thermal signals. Specifically, an SVR with RBF kernel was trained on the SI obtained from Kubios through a supervised learning procedure. The SVR-RBF was trained on z-scored data with a fixed nonlinearity exponential parameter \(\gamma\) = 1.  
Because of the multivariate (6 regressors) SVR approach, in-sample performance of the procedure did not reliably estimate the out-of-sample performance. The generalization capabilities of the procedure were thus assessed through cross-validation. Specifically, a leave-one-subject-out cross-validation was performed [45]. This cross-validation procedure consisted in leaving one subject (specifically all the samples from the same subject) out of the regression and in estimating the predicted output value on the given subject using the other participants as the training set of the SVR model. This procedure was iterated for all the subjects, and further statistical analyses were performed on the out-of-training-sample estimation of SI from thermal features. Such a metric was labelled SICross.  
Although several machine learning approaches could be suited for such a purpose, given the limited number of independent features available and the exploratory nature of the implemented approach, an SVR-RBF followed by a classification procedure was chosen to limit the procedural complexity. In fact, although SVR-RBF is not a sophisticated approach, it ensures performances which are comparable to more complex machine learning techniques [46].  
Secondly, SICross was used to perform a two-level classification of the driver's stress (i.e., STRESS versus NO STRESS). The two classes were defined on the basis of the threshold associated to a stress condition assessed by the SI (i.e., SI \(>\) 150 for stress condition) [18]. Notably, the experimental recordings confirmed the accordance between SI and the driving conditions. In particular, stressful situations assessed by SI were associated to adverse events during driving simulations (e.g., traffic accidents, collisions with pedestrians, sudden car braking).  
Since the two classes did not have an equal number of samples, a bootstrap procedure was implemented to test classification performance on balanced classes [47]. The performances of the classification were evaluated by means of receiver operating characteristic (ROC) analysis [48].  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Region of Interest (ROI)** & **ROI Shape** & **ROI Position Relative to 68 Facial Landmark** \\ \hline ROI 1—Nose tip & Circle & C = \(\left[\frac{\text{x}_{11}+\text{x}_{34}}{2},\frac{\text{y}_{12}+\text{y}_{34}} {2}\right]\), d = 7 pixel 1 \\ ROI 2—Right nostril & Circle & C = \(\left[\text{x}_{33},\text{y}_{33}\right]\), d = 7 pixel 1 \\ ROI 3—Left nostril & Circle & C = \(\left[\text{x}_{35},\text{y}_{35}\right]\), d = 7 pixel 1 \\ ROI 4—Glabella & Polygon & Polyline ([P22, P23, P28]) 2 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Geometrical features of the considered ROIs.  
Figure 5 reports the flow chart relating to the described machine learning approach.