# Privacy Preserving Classification of EEG Data Using Machine Learning and Homomorphic Encryption
## 3 Results
### Use Case 1--Seizure Detection  
We ran multiple experiments for the seizure detection use case, relying on different input data configurations:  
* Using all 178 initial data points in each sample as input. * Using all 178 initial data points in each sample and the 178 corresponding quadratic terms (356 features overall). Figure 4: Dependence between the number of terms in the polynomial encoding, the numerical error and the execution time, respectively. Figure 3: Impact of input data size on the total number of arithmetic operations (**left**), total runtime (**mid**) and maximum value (**right**). The total number of data samples was varied while keeping the number of features fixed (**top**) and the number of input features was varied while keeping the number of samples fixed (**bottom**). * Using a downsampled version of each sample. The number of data points was gradually reduced from 178, and the mean NCC over the entire dataset was computed for each downsampled version. We selected the downsampled version with the smallest number of data points for which the average NCC was still larger than 0.95. The selected downsampled version had 40 features (instead of the initial 178) and the corresponding quadratic terms were added, leading to a total of 80 features per sample. Figure 1 displays the variation of the mean NCC as a function of the number of samples. Figure 2 displays, for one signal, the original sample and the resampled sample for different numbers of data points. For all three input data configurations, the experiments were first conducted using the plaintext data: both a multivariate polynomial regression and an SVM model were evaluated, using five-fold cross-validation. The optimal values of the SVM parameters were determined by performing a grid search. For this use case, the best results were obtained for \(\
u=0.3\) and \(C=1\). Thus, by setting \(\
u=0.3\), we considered that, at most, 30% of the training samples are allowed to be wrongly classified and at least 30% of them act as support vectors. Table 1 displays the classification metrics aggregated over all five folds: accuracy, sensitivity, specificity, positive predictive value, negative predicted value. For each of the five folds, the metrics were computed only on the testing subset. While the SVM model is largely independent of the input data configuration, the performance of the polynomial regression model increases significantly both when adding the quadratic terms and when reducing the number of data points per sample (increase in performance stems mainly from an increase in sensitivity). After analyzing the performance obtained using SVM, before and after downsampling the signal, we conclude that this pre-processing step does not influence the classification process. For the last input data configuration (80 features) the polynomial regression model was also trained on ciphertext values, considering the encoding precision parameter equal to 35 and a 256-bit encryption key. The results were identical down to double precision when compared to the plaintext experiment. When choosing the precision parameter for this use case, the synthetic date results were taken into account. As the quadratic resampled dataset has a larger number of features (80 compared to 5) and training samples (9200 compared to 1000), to ensure no loss in performance, the precision parameter was chosen to be equal to 35, which is larger than the values used in the synthetic data experiments displayed in Figure 4.  
In terms of computational time, a comparison between the plaintext and ciphertext polynomial regression experiments is displayed in Table 2. For both training and inference, the time increases for the encrypted version. However, the inference time remains in the order of milliseconds. For the parallelized version, four processes were employed.