## 2 Materials and Methods
### Machine Learning Analysis  
Machine learning was applied to find the best selection of variables from the VSG that predict whether the subjects would have high or low scores in the study variables. The best predictive model was obtained for each scale. If the scale had more than one set  
Figure 4: Main study variables and their outputs.  
of variables (self-esteem and self-efficacy), we also investigated which set achieved better results. In addition, whether or not to include demographic variables to predict each scale was also studied.  
The process of feature selection and modelling was common to all scales and followed the scheme described in Figure 5. Different machine learning algorithms (Table 6) were tested to predict the study variable subscales. The following steps were validated using 15-fold cross-validation (CV):  
Feature selection: The wrapper method of backward sequential feature selection was chosen. Starting from a model with all the features, in each step the feature that decreased the performance measure the most was removed. The maximum possible number of features that could be selected was 15 to avoid overfitting.  
Hyperparameter tuning: Once a set of the best features was obtained, hyperparameter tuning was performed. Different hyperparameters, as shown in Table 6, were optimized in each machine learning algorithm. Ten equal-sized values in the range defined for each hyperparameter were evaluated. In the case of the support vector machine (SVM) hyperparameters, an exponential transformation (\(2^{\text{x}}\)) was applied to the values. The search for the best hyperparameters for the machine learning models was limited and not continuous, so the chosen hyperparameters might not be optimal. This also might help to avoid overfitting.  
Modeling: Once the best features and hyperparameters for each machine learning algorithm were obtained, the model was trained and validated with 15-fold CV to obtain the average of metrics (accuracy, Cohen's kappa, sensibility (True Positive Ratio; TPR), and specificity (True Negative Ratio; TNR)). The average of the metrics achieved in each fold is reported.  
All analyses (outlier detection, Chi-square test, and machine learning) were performed on R software (version 3.6.1).  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Model** & **Parameter** & **Values** \\ \hline \multirow{2}{*}{Conditional inference trees} & Maximum depth & (0, 100) \\ \cline{2-3}  & Minimum sum of weights in a node to be considered for splitting & (5, 100) \\ \hline \multirow{2}{*}{Random forest} & Number of trees & (100, 1000) \\ \cline{2-3}  & Number of variables randomly sampled as candidates at each split & (5, 100) \\ \hline \multirow{2}{*}{Support vector machine (SVM)} & C & (\(-10\), 10) \\ \cline{2-3}  & Sigma & (\(-10\), 10) \\ \hline \multirow{2}{*}{Generalized linear model (GLM) with lasso or elastienet regularization} & Alpha & (0, 1) \\ \hline \hline \end{tabular}
\end{table}
Table 6: Machine learning algorithms used, hyperparameters tuned, and values tested.  
Figure 5: Machine learning strategy followed for each algorithm in Table 5 and each subscale to predict. Feature selection was made and validated by cross-validation (CV). When the best features were obtained, hyperparameter tuning was carried out, also validated with CV. With the best features and hyperparameters, modelling was done, and metrics were obtained by CV.