## 3 Methodology
### Processing
#### 3.2.5 Physiological Based ASD Prediction  
To classify ASD, we used a Machine Learning (ML) technique with a k-nearest neighbours (KNN) classifier based on a LOOCV strategy. For this purpose, we used only the features able to distinguish physiological responses from ASD and TD groups (according to the results from the Mann-Whitney tests). Regarding the prediction, we only considered the CO and BO data because the inclusion of baseline did not improve the performance of the KNN (as shown in preliminary analysis).  
KNN is a supervised ML technique that can be applied to classification and regression problems. The primary objective of the KNN classification technique is to determine the class of a new case based on the classes of the k most comparable items in the database [51]. In other words, the KNN method seeks out elements with the highest degree of similarity to a query element, where the degree of similarity is determined by a distance function, to classify that point. Each database element has an associated label (class) [51].  
Figure 2: Division of signal into two distinct groups: CO and BO.  
LOOCV is a special case of k-fold cross-validation, where the model is trained on almost all data in each iteration, except for a single observation, and tested on that single observation. A precision estimate derived by LOOCV is almost impartial but has a huge variance, resulting in inaccurate estimations. Nonetheless, this technique is often used when the dataset size is small [52]. Considering the small number of participants, especially from the ASD group, this was the evaluation strategy for training and testing.  
The True Positive (i.e., correct classification of a participant as belonging to the ASD group), True Negative (i.e., correct classification of a participant as belonging to the TD group), False Positive (i.e., incorrect classification of a participant as belonging to the ASD group), and False Negative (i.e., incorrect classification of a participant as belonging to the TD group) metrics were extracted from the contingency table. In a binary decision problem, a classifier assigns positive or negative labels to examples; in this case, being the class of interest, ASD are positive examples and TD are negative examples [53].  
The respective precision, recall, negative predictive value, specificity, accuracy, and F1-score were also calculated:  
* Precision = \(TP/(TP+FP)\) is the proportion of instances predicted as Positive (ASD) that were correct; the optimal value for precision is 1 [54].
* Recall = \(TP/(TP+FN)\) is the proportion of instances labelled as Positive (ASD) that were correctly predicted; the optimal value for the recall is 1 [54].
* Negative Predictive Value = \(TN/(TN+FN)\) is the proportion of instances predicted as Negative (TD) that were correct; the optimal negative predictive value is 1 [54].
* Specificity = \(TN/(TN+FP)\) is the proportion of instances labelled as Negative (TD) that were correctly predicted; the optimal value for specificity is 1 [54].
* Accuracy = \((TP+TN)/(TP+TN+FP+FN)\) is the ratio of the number of correctly classified samples to the total number of samples, and its optimal value is 1 [55].
* F1-score = \((2 xPrecisionxRecall)/(Precision+Recall)\) is defined as the harmonic mean of precision and recall. F1-score has a range of [0, 1], with TP = 0 (i.e., when all of the positive samples are incorrectly categorised) as its lowest and FN = FP = 0 (perfect classification) as its maximum. F1 differs from accuracy in two key ways: it is independent of TN, and it is not symmetric for class switching [55].