## 3 Methodology
### Performance Metrics  
To measure the performance of the models, five types of evaluation are used: (i) accuracy, (ii) precision, (iii) sensitivity, (iv) specificity, and (v) F1-score. The mathematical equations of these are as follows:  
\[\text{Accuracy}=\frac{\text{TP}}{\text{TP}+\text{TN}+\text{FP}+\text{FN}} \tag{1}\]  
\[\text{Precision}=\frac{\text{TP}}{\text{TP}+\text{FP}} \tag{2}\]  
\[\text{Sensitivity}=\frac{\text{TP}}{\text{TP}+\text{FN}} \tag{3}\]  
\[\text{Specificity}=\frac{\text{TN}}{\text{TN}+\text{FP}} \tag{4}\]  
\[\text{F1 Score}=\frac{2\times(\text{Precision}\times\text{Sensitivity})}{ \text{Precision}+\text{Sensitivity}} \tag{5}\]  
where TP = True Positive, TN = True Negative, FP = False Positive, and FN = False Negative [55]. Feature extraction in EEG signal processing involves identifying and isolating relevant information from raw EEG signals to enhance classification or analysis. This process typically starts with preprocessing steps such as band-pass filtering and artifact removal to ensure clean data. Time-domain features such as amplitude, power, and zero-crossing rate provide insights into the signal's intensity and variation. Frequency-domain features such as power spectral density (PSD) and band power offer a breakdown of the signal's  
Figure 20: The pipeline of the ML-CSP-OVR model. energy across different frequency bands, which is crucial for understanding various cognitive states. Time-frequency domain features, including Wavelet Transform (WT) and Short-Time Fourier Transform (STFT), capture how the signal's spectral content evolves over time, which is particularly useful for non-stationary EEG signals. Spatial features such as Common Spatial Patterns (CSP) and Independent Component Analysis (ICA) enhance the differentiation between brain states by focusing on spatial patterns of brain activity. Non-linear features such as the fractal dimension and Lyapunov exponent provide additional insights into the complexity and chaotic nature of EEG signals. Often, a combination of these features is employed to capture the full range of information in the EEG data. After feature extraction, feature selection techniques such as Principal Component Analysis (PCA) are applied to reduce dimensionality before feeding the features into classification models, which can range from simple linear classifiers to advanced machine learning algorithms such as Support Vector Machines (SVMs) or deep neural networks. This systematic approach to feature extraction is critical for developing accurate and reliable EEG-based applications, including Brain-Computer Interfaces (BCIs). To summarize, the data processing and feature extraction steps in the study began with data collection from 12 participants, each performing 10 sessions of grasp and lift (GAL) trials. Trials exceeding 28 were discarded to standardize the dataset, and visual inspection ensured a consistent 3 s duration for each trial, leading to the exclusion of participant 7 due to inconsistencies. The raw EEG signals were filtered to remove noise, and four 1 s segments were extracted from the filtered data, each being 500 samples long. Common Spatial Patterns (CSP) were employed to extract spatial features, selecting six spatial filters to distinguish between conditions. Event-Related Desynchronization/Synchronization (ERD/ERS) features captured power changes in specific EEG frequency bands associated with motor activities. CSP filters produced time projections for classification, with steps including covariance matrix estimation and whitening transformation. The initial model used K-Nearest Neighbors (KNN) with three nearest neighbors and 10-fold cross-validation, achieving accuracies of 57.23% for forward-reverse pairs and 50.87% for grasp-release pairs. Convolutional Neural Networks (CNNs) were later used for final classification, validated with an 80:20 training/validation split, although Model 3, which involved majority voting, was not implemented due to performance issues.