# Privacy Preserving Classification of EEG Data Using Machine Learning and Homomorphic Encryption
## 3 Results
### Use Case 2--Predisposition to Alcoholism  
The evaluation of the second use case was performed on the pre-processed testing dataset. When designing the experiment, we started from the fact that the dataset consists of 153,600 samples of 64 features corresponding to the 64 electrodes, and the ground truth labels. Moreover, we also took into account that the computational time required for an experiment on the ciphertext data increases considerably once the number of samples becomes larger than 10,000. Thus, as the purpose of this paper is not to find a state-of-the-art model, a balanced subset of 10,000 samples from the training dataset was considered for our experiments. We have designed the following plaintext experiments:  
* \(E_{1}\)-- The machine learning models were trained on the original dataset (153,600 samples and 64 features). * \(E_{2}\)-- The machine learning models were trained on 10,000 balanced samples. The number of features was unchanged: 64. This is the baseline experiment to be conducted also on the ciphertext data (\(E_{1}\) cannot be run on ciphertext since the number of samples is too large). * \(E_{3}\)-- The machine learning models were trained on the entire dataset (153,600 samples) and all polynomial combinations of features with degrees less than or equal to 2 were considered, leading to a total of 2145 features. The idea is to determine whether increasing the model complexity leads to better performance. Due to the large number of features, it is not feasible to run this experiment on ciphertext data. * \(E_{4}\)-- The machine learning models were trained on 10,000 balanced samples with 128 features (the original 64 and their quadratic terms). Considering the computational overhead introduced by the encoding and encryption steps, \(E_{4}\) represents a suitable trade-off solution. For the plaintext experiments, we also used the SVM approach. The parameters of the SVM classifier that lead to the best performance were obtained through a grid search (\(\
u=0.5\) and \(C=1\)). In Table 4, we display the classification results for samples \begin{table}
\begin{tabular}{c c c c} \hline \hline  & **Plaintext** & **Ciphertext** & **Ciphertext** \\ \hline Training runtime/fold & 0.0119 s & 23.60 h & 7.05 h \\ Inference runtime/sample & 1.73 \(\times\) 10\({}^{-6}\) s & 0.012 s & \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Training and inference runtime comparison between plaintext and ciphertext implementation versions for the seizure detection use case. \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline  & \multicolumn{6}{c}{**Precision Parameter (Number of Terms)**} \\ \cline{2-7}  & **35** & **32** & **29** & **26** & **23** & **21** & **20** \\ \hline Loss in accuracy & 0 & 0 & 0 & 0 & 0 & 0 & 1.66 \\ Runtime/fold (hours) & 7.05 & 6.02 & 4.69 & 3.89 & 2.97 & 2.41 & 2.16 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Influence of the precision parameter on the loss of accuracy and on the computational time for the EEG-based seizure detection use case. representing individual time points, recorded by the 64 electrodes at a given moment. All reported metrics were computed using only the testing dataset. The columns represent the results of the experiments described above, where the input was normalized in the range [\(-\)1, 1]. Because in \(E_{4}\), only some of the polynomial combinations of features are used (the original and quadratic features) and the training is performed on only the 10,000 samples subset from \(E_{2}\), the accuracy is increased when compared to \(E_{1}\) (original dataset), and the computational cost is significantly reduced compared to \(E_{3}\). While adding the quadratic terms improves the performance of the polynomial regression algorithm, the SVM algorithm leads to similar performance for \(E_{2}\) and \(E_{4}\).