A schematic overview of the EEG preprocessing, feature extraction, and classification workflow is shown in Figure 1. The materials and software used in the study are listed in the Table of Materials.

Figure 1: Workflow of the EEG preprocessing, feature extraction, and classification pipeline. Schematic overview of the study workflow, including EEG data verification, band-pass filtering and re-referencing, extraction of root mean square (RMS), power spectral density (PSD), and entropy features, addition of age, train-test splitting, Random Forest model development, feature-stability analysis, SHAP analysis, Cohen’s d effect-size analysis, integrated feature selection, entropy-feature ablation, model retraining, and performance evaluation. Please click here to view a larger version of this figure.
1. Data acquisition
The publicly available resting-state EEG dataset was obtained from the OpenNeuro repository (dataset ds004504, version 1.0.9)33. Participant labels and demographic information were verified. The dataset comprised 88 participants, including 36 participants with Alzheimer’s disease (AD), 23 with frontotemporal dementia (FTD), and 29 healthy controls (HC).
2. EEG recording import
For each participant, the EEG recording was loaded using the MNE-Python library. Each EEG file was checked to confirm that it was accessible, could be successfully imported, and contained a valid participant identifier. Recordings with missing or corrupted files were excluded. The original EEG sampling frequency of 500 Hz was retained at this stage. The signals were downsampled to reduce computational load while preserving all clinically relevant EEG information for this study.
3. Band-pass filtering
The continuous EEG recordings were filtered using a fourth-order band-pass filter with a low cutoff frequency of 0.5 Hz and a high cutoff frequency of 40 Hz.
4. Common average referencing and epoching
Common average referencing (CAR) was applied to the filtered EEG recordings. At each time sample, the average signal across all available EEG channels was calculated and subtracted from each channel. The referenced EEG signals were retained for subsequent analysis. Each referenced EEG recording was segmented into fixed-length epochs using the make_fixed_length_epochs() function in MNE-Python. An epoch duration of 10 s with 0 s overlap was used.
5. Epoch validation
For each participant, only complete 10s epochs were retained. Any remaining EEG segment shorter than 10 s at the end of a recording was discarded. Each retained epoch was subsequently used as an individual sample for feature extraction.
6. Feature preparation
Although Mini-Mental State Examination (MMSE) data were available in the source dataset, they were excluded from the present analysis. The extracted EEG features were merged with participant demographic information, including age and diagnostic labels, obtained from the participants.csv metadata file. The participant identifier was used as the common key, and only participants with both EEG feature records and corresponding demographic information were retained.
The multidomain feature matrix included five root mean square (RMS) features (delta_rms, theta_rms, alpha_rms, beta_rms, and gamma_rms), five power spectral density (PSD) features (delta_psd, theta_psd, alpha_psd, beta_psd, and gamma_psd), and five entropy features (delta_entropy, theta_entropy, alpha_entropy, beta_entropy, and gamma_entropy). Age was included as a complementary demographic variable. Because age distributions may differ across diagnostic groups, demographic confounding could not be completely ruled out. Diagnostic group, defined as AD, HC, or FTD, was assigned as the target label.
7. Data preprocessing and train-test partitioning
During preprocessing, the recordings were downsampled from 500 Hz to 250 Hz to reduce computational requirements while retaining the EEG frequency information of interest.
The dataset was partitioned into training (80%) and testing (20%) subsets at the subject level using a grouped splitting strategy. Subject-level predictions were subsequently obtained by majority voting across the predicted epochs belonging to each participant. The primary evaluation used a subject-level grouped train-test split to prevent epochs from the same participant from appearing in both subsets. Subject-level predictions were obtained by majority voting across the predicted epochs belonging to each participant. The dataset was inspected for missing values, and missing observations were removed or imputed as applicable. Diagnostic labels were encoded. A StandardScaler was fitted on the training data and then applied to both the training and testing datasets.
8. Random forest model development
A Random Forest classifier was initialized using 80 trees, a maximum tree depth of 10, a maximum of four features, a minimum of five samples per leaf, and a random state of 42. The classifier was trained using the standardized training dataset.
9. Model evaluation
Class labels were predicted for both the training and testing datasets. A confusion matrix was constructed, and accuracy, precision, recall, and F1-score were calculated together with the classification report. Training and testing accuracies were recorded.
For the participant-wise evaluation, ensure that all epochs from a given participant were assigned exclusively to either the training or testing subset. The Random Forest classifier was trained using the same hyperparameters as in the primary analysis.
10. Cross-validation
As an additional model-evaluation procedure, five-fold stratified cross-validation was performed using shuffle = True and random_state = 30. The mean accuracy and standard deviation across the five folds were calculated. This analysis was considered separately from the primary subject-level holdout evaluation.
11. Feature-stability analysis
Feature stability was assessed by repeating Random Forest training 10 times using random seeds from 0 through 9. For each run, test accuracy and feature-importance scores were recorded. The mean and standard deviation of the feature-importance score for each predictor were calculated across the 10 runs, and the predictors were ranked according to their stability. This analysis was used to assess the consistency of feature rankings rather than to replace the primary subject-level evaluation.
12. Explainable artificial intelligence analysis
SHAP TreeExplainer was applied to the trained Random Forest model. SHAP values were calculated to estimate each feature's contribution to the model's predictions. The mean absolute SHAP value was calculated for each feature, and features were ranked according to their SHAP contributions. Features with consistently low SHAP values were identified and compared with the results of the feature-stability and Cohen’s d analyses. Features showing consistently low contributions were selected for subsequent ablation and model retraining.
13. Statistical effect-size analysis
Cohen’s d was calculated for each EEG biomarker for the AD versus HC, AD versus FTD, and FTD versus HC comparisons. Effect-size magnitudes were interpreted using thresholds of 0.20 for a small effect, 0.50 for a medium effect, and 0.80 for a large effect.
14. Integrated feature selection
The results of the Random Forest feature-importance analysis, SHAP analysis, and Cohen’s d analysis were compared. Predictors that consistently exhibited low feature importance, low SHAP contribution, and small effect sizes were identified as candidates for removal.
15. Feature ablation
Entropy features were evaluated in an exploratory ablation analysis, and a reduced feature matrix containing RMS, PSD, and age was constructed. The Random Forest classifier was retrained using the same hyperparameters. Model training, testing, cross-validation, and receiver operating characteristic (ROC) analysis were repeated using the reduced feature set.
16. ROC analysis
Class probabilities were obtained from the optimized Random Forest classifier. Multiclass ROC curves were generated using a one-versus-rest strategy. Class-specific area under the curve (AUC) values and the average AUC were calculated.
17. Performance comparison
The performance of the complete feature model was compared with that of the reduced feature model obtained after entropy-feature ablation.