# EEG Signal Processing and Supervised Machine Learning to Early Diagnose Alzheimer's Disease
## 2 Materials and Methods
### Classification  
The signal classification is performed by an SML analysis through three classification methods: decision trees (DT), support vector machines (SVM), and k-nearest neighbor (KNN) [28]. The algorithms are implemented in Python (version 3.7.21) by means of the scikit-learn toolkit [29]. Python is an open-source programming language, and its choice stems from the availability of many external libraries, frameworks, and tools from a huge community distributed all over the world. In this study, we define five classification problems: (i) AD vs. HC, (ii) AD vs. MCI, (iii) MCI vs. HC, (iv) AD + MCI vs. HC, and (v) AD vs. MCI vs. HC. The first four problems were addressed in our previous study [24], whereas the last one defines the three class classification problem [30]. Then, for each problem, we perform 10 runs where the extracted features are randomly sampled. Finally, we adopt the following procedure:  
1. Dataset splitting in training 70% and data tests 30%, except for the (v) case where the data has been divided into 80% training and 20% data tests;
2. Dataset size reduction with the Linear Discriminant Analysis (LDA) [31];
3. Application of the three aforementioned supervised machine learning methods;
4. Tuning of the hyperparameters of the machine learning algorithms combined with k-fold cross validation [32];
5. Data validation and performance evaluation through the confusion matrices. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**N-Subjects** & **EEG Signals** & **Label** & **Extracted Features** \\ \hline
1 & \(EEG_{1},EEG_{2},\dots,EEG_{19}\) & AD & \(P_{(L-H)_{1}}^{2},\ P_{(L-H)_{2}}^{2},\dots,\ P_{(L-H)_{19}}^{2}\) \\
2 & \(EEG_{1},EEG_{2},\dots,EEG_{19}\) & MCI & \(P_{(L-H)_{1}}^{2},\ P_{(L-H)_{2}}^{2},\dots,\ P_{(L-H)_{19}}^{2}\) \\ \(\dots\) & \(\dots\) & \(\dots\) & \(\dots\) \\
109 & \(EEG_{1},EEG_{2},\dots,EEG_{19}\) & HC & \(P_{(L-H)_{1}}^{2},\ P_{(L-H)_{2}}^{2},\dots,\ P_{(L-H)_{19}}^{2}\) \\ \hline \hline \end{tabular} The column Label shows the initial labeling used in supervised machine learning.  
\end{table} 
Table 1: Schema of the feature extraction procedure: features extracted from an EEG recording are shown in the last column. Figure 1: Schematic representation of the double filtering method. The initial input is the subsequence of the main EEG signal, which is divided and filtered according to the two main branches. The final result is the square of the power absolute difference. The block “Power” is explained in Appendix A. Regarding point 1, data splitting can affect the performance of evaluators, so making appropriate decisions during this step is very challenging, as highlighted in [33]. Here, the authors summarize the challenges of data splitting into three main points: (i) Data imbalance, (ii) Data loss, and (iii) Concept drift. Taking these points into consideration, we divide the initial datasets into 70-30 and 80-20. The first choice shows very high levels of accuracy in the first four cases of the classification; on the contrary, 80-20 has an accuracy increase of 5% in the three-class classification problem. In order to reduce the less meaningful features, we applied the LDA to the extracted features. The LDA, cited at point 2, is a well-known data mining algorithm [34] and is suitable in those cases where classes are unbalanced or nonlinearly separable, such as the EEG signal. LDA automatically defines a separation hyperplane between the points that belongs to a class by generating two subclasses from the main one. Consequently, the Fisher criterion [35], also called Fisher's linear discriminant, maximizes the ratio of the between-class variance to the within-class variance in any particular dataset, ensuring the maximum separation. In this way, it is possible to discard those values of the extracted features that do not affect the variance of the main class, decreasing the sample dimensions.