## 2 Materials and Methods
### Modelling
#### 2.2.3 Emotion Classification  
To examine the significance of the TF model orders and parameters for emotion recognition, classification accuracies needed to be determined. For this aim, the model orders and parameters of each modelled mental HR response were used as features in subject-specific ML classifiers. Therefore, the data of each participant were randomly divided into a training (70%) dataset and a validation (30%) dataset of the labelled events. Every emotion that was labelled less than three times, was removed from the dataset. Some participants did not have more than one emotion that was labelled at least three times. Therefore, not every participant's data were used for this part of the analysis. The performances of three often used ML algorithms in emotion recognition were compared to each other: the k-nearest neighbours (KNN), support vector machine (SVM) and decision trees algorithms. The KNN classifier is based on the assumption that similar samples are located in close proximity to each other. Every sample of the training data set is presented in an n-dimensional space, with n the number of calculated features. Every new sample of the testing data set is classified in the category that is closest by, mostly in terms of Euclidian distance [41]. The SVM algorithm tries to find the optimal distinguishability between two or more classes. Distinguishability is defined as the margin between the different classes. In the n-dimensional feature space, different hyperplanes exist that could separate samples from different classes. The SVM algorithm guarantees that the chosen hyperplane is the one that maximizes the distinguishability between the classes [42]. In the decision tree algorithm, the goal is to classify new data from the testing set based on simple decision rules derived from the calculated features. Each leave of the tree represents a decision rule, after which the data is split into the nodes [41; 42]. For every participant, a table was made, in which each row represents an event, and the columns contain the model orders and parameter values. In total, there were four features for each labelled event: number of a-parameters, number of b-parameters, value of the a-parameter(s) and value of the b-parameter(s). The time delay \(\delta\) was not used as a feature in this classification, because it accounts more for possible misalignments of the data labelling and pre-processing than for a real delay. The first column contained the emotion label for each event. Next, the tables were imported into the Classification learner app in MATLAB and randomly split into a training (70%) and validation (30%) dataset [43]. In this learner, the KNN, SVM and decision trees algorithms with automated hyperparameter optimisation were chosen. For the KNN algorithm, the number of nearest neighbours, the distance metric, distance weight and standardization of the data (yes or no) were optimized. In the SVM algorithm, the kernel function, box constraint level, kernel scale, multiclass method (one VS one or one VS all) and the standardization of the data (yes or no) were optimized. Lastly, for the decision tree algorithm, the maximal number of splits and the split criterion were optimized [44]. The ML algorithms were applied to the data and the classification accuracies of each participant were considered. The classification accuracies were compared to the classification accuracies of a random classifier with the same number of emotions. This percentage was calculated as the inverse of the number of emotions labelled by the participant. Besides that, also the confusion matrices and receiver operating characteristics (ROC) curves were considered to evaluate the classification performance of the best-performing ML algorithm. Classification accuracy is not an optimal performance criterion if there is a big class imbalance, thus, if the samples are far from equally distributed over the different possible classes. The confusion matrix gives additional information on the interpretation of the classification accuracy [45].