## 3 Results and Discussion  
We started with hyperparameter optimization for all algorithms and all types of input data (Table 2). We tested the models with different types of distance estimation metrics, and the GridSearch method chose the Euclidean distance as the best metric. Therefore, we proceeded with the Euclidean distance in all calculations. The OCSVM performed better with the rbf kernel when the gamma was set to scale. The obtained results provided the following insights. First, the LNND and LOF required more neighbours than kNN. Second, the parameters of the OCSVM did not depend on the type of input data. Third, in the distance-based methods the threshold had the smallest value for PCA and the highest value for the 30 Hz and 3 Hz spectral power. \begin{table}
\begin{tabular}{c c c} \hline
**Algorithm** & **Hyperparameter** & **Range of Values** \\ \hline \multirow{4}{*}{OCSVM} & Nu & \(10^{i}\), \(i\in[-6\), \(-1]\) \\  & Gamma & \(10^{i}\), \(i\in[-6\), \(-1]\), and ‘scale’ \\  & Tol & \(10^{i}\), \(i\in[-6\), \(-1]\) \\  & Kernel type & ‘rbf’, ‘poly’, ‘sigmoid’ \\ \hline \multirow{4}{*}{kNN, LNND, LOF} & N\_neighbors & \(i\in[1\), \(20]\) \\  & Algorithm & ‘Euclidean’, ‘manhattan’, ‘cosine’ \\  & Threshold (for kNN, LNND), \% & \(j\times 10^{i}\), \(i\in[-4\), \(1\), \(j\in 1\), \(5\) \\  & Contamination (For LOF) & \(j\times 10^{i}\), \(i\in[-6\), \(-1]\), \(j\in 1\), \(5\) \\ \hline IF & Contamination & \(j\times 10^{i}\), \(i\in[-6\), \(-1]\), \(j\in 1\), \(5\) \\ \hline \end{tabular}
\end{table} 
Table 1: The range hyperparameter values examined by the GridSearch method. After finding the optimal combination of hyperparameters, an individual model was trained for each patient, i.e., 80 models were obtained for each ML method. Then, the recall, precision, and \(F1\)-score were calculated, and these values were averaged for a group of patients (see Table 3). These results show that OCSVM, kNN, and IF reach the highest performance on the raw data, while the LNND and LOF perform better on PCAs. The best results were demonstrated by the LNND trained using 30 Hz PCAs. To test if the \(F1\)-score changed between algorithms, we used the non-parametric Friedman test. For the mean value in the 3 Hz band, there was a statistically significant difference in the \(F1\)-score depending on which algorithm was used, \(\chi^{2}(4)=91.731\), \(p<0.001\). Post hoc analysis with [PERSON]'s tests was conducted with a Bonferroni correction applied, resulting in a significance level set at \(p<0.01\). There was a significant difference in the \(F1\)-score between the LNND and other algorithms (Table 4). \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline
**Algorithm** & **Hyperparameter** & \multicolumn{6}{c}{**Input Data**} \\  & **30 Hz** & **3 Hz** & **30 Hz Mean** & **3 Hz Mean** & **30 Hz PCA** & **3 Hz PCA** \\ \hline \multirow{3}{*}{OCSVM} & Nu & 0.1 & 0.1 & 0.1 & 0.1 & 0.1 & 0.1 \\  & Gamma & & & scale & & \\  & Tol & 0.1 & 0.1 & 0.1 & 0.1 & 0.1 & 0.1 \\  & Kernel type & & & rbf & & & \\ \hline \multirow{3}{*}{kNN} & N\_neighbors & 3 & 3 & 4 & 4 & 4 & 3 \\  & Threshold, \% & 0.5 & 0.5 & 0.1 & 0.1 & 0.1 & 0.1 \\  & Algorithm & & & Euclidean & & & \\ \hline \multirow{3}{*}{LNND} & N\_neighbors & 5 & 8 & 9 & 9 & 9 & 7 \\  & Threshold, \% & 0.5 & 0.5 & 0.5 & 0.5 & 0.1 & 0.1 \\  & Algorithm & & & Euclidean & & & \\ \hline \multirow{3}{*}{LOF} & N\_neighbors & 7 & 8 & 8 & 8 & 8 & 3 \\  & Contamination & 0.005 & 0.005 & 0.001 & 0.005 & 0.001 & 0.0001 \\  & Algorithm & & & Euclidean & & & \\ \hline IF & Contamination & 0.001 & 0.005 & 0.001 & 0.001 & 0.001 & 0.005 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: The optimal hyperparameters that provide the highest \(F1\)-score for the different algorithms and types of input data.