Split data into 10 parts based on time (timestamps) and apply the train-test-val split for each part.
EEGNet / DeepConvNet / ShallawNet / LSTM / DGCNN / TCN/ ATCNET / EEGTransformer
one session / cross sessions no sampling / class weights / undersampling / oversampling / kfold cross validation (normal split)
EEGNet - one session:
EEG Data Shape: (80300, 2000)
Training label distribution:
Validation set label distribution:
Testing set label distribution:
No sampling:
Class weights:
Undersampling:
Oversampling:
kfold cross validation:
Undersampling
Final Average Training Accuracy: 57.27%
Final Average Testing Accuracy: 36.56%
Oversampling
Final Average Training Accuracy: 77.88%
Final Average Testing Accuracy: 36.58%
EEGNet - cross sessions:
1 - EEG Data Shape: (102838, 2000)
2 - EEG Data Shape: (93569, 2000)
3 - EEG Data Shape: (83650, 2000)
4 - EEG Data Shape: (80300, 2000)
5 - EEG Data Shape: (91344, 2000)
6 - EEG Data Shape: (104990, 2000)
7 - EEG Data Shape: (94723, 2000)
8 - EEG Data Shape: (92417, 2000)
Combined data shape: (743831, 2000)
Training set shape: (476041, 2000)
Validation set shape: (119020, 2000)
Testing set shape: (148770, 2000)
Training label distribution:
Validation set label distribution:
Testing set label distribution:
No sampling:
Class weights:
Undesampling:
Oversampling:
kfold cross validation:
Final Average Training Accuracy: 46.95%
Final Average Testing Accuracy: 8.24%
Quality of EEG data:
Preprocessing Techniques Applied:
Power Spectral Density (PSD): Plots were generated before and after preprocessing to visualize changes in the signal. Artifact Removal: Independent Component Analysis (ICA) was used to identify and remove artifacts. EOG artifact detection was skipped due to the absence of suitable EOG channels. eog_inds, _ = ica.find_bads_eog(raw) # Detects eye-blink-related components ecg_inds, _ = ica.find_bads_ecg(raw) # Detects heartbeat-related components Noise Reduction: Notch filters were applied to remove powerline noise at 50 Hz, followed by a bandpass filter (1-40 Hz) to focus on EEG-relevant frequencies. Normalization: Z-score normalization was applied to standardize the signal amplitude across channels.
Quality Metrics:
Signal-to-Noise Ratio (SNR): Before Preprocessing: SNR was 0.00 dB, indicating low signal quality. After Preprocessing: SNR improved to 40.42 dB, showing a significant enhancement in signal quality. Artifact Rejection Rate: No artifacts were detected in the final data set (0.00%). Noise Reduction: The noise power was consistent before and after preprocessing, with a rate of 0.00%, indicating that the applied filters effectively isolated the EEG signal without introducing new noise. Total Power Analysis: Both the total power and noise power before and after preprocessing remained at 171,614.16 and 15.57, respectively.
Step 1: Preliminary Data Check
Purpose: To verify that the data has been correctly recorded and that there are no obvious issues. Inspect raw data visually: Use visualization tools like EEGLAB (MATLAB), MNE (Python), or any EEG software to plot the raw EEG signals from all channels. Check for signal continuity: Ensure that there are no flat lines (indicating lost signal) or sudden spikes (suggesting artifacts or signal issues). Look for channel integrity: Verify that all channels are functioning and displaying data consistently without excessive noise. Step 2: Artifact Detection and Removal
Purpose: To identify and handle non-neural artifacts (e.g., eye blinks, muscle movements, and power line noise) in the EEG data. Apply filters: Use a bandpass filter (e.g., 1-50 Hz) to remove low-frequency drifts and high-frequency noise, and a notch filter (e.g., 50/60 Hz) to eliminate power line interference. Use Independent Component Analysis (ICA): Apply ICA to identify and remove components related to artifacts such as eye blinks, muscle movements, or external electrical noise. Validation: Check if the cleaned data still shows clear EEG signals, especially over the occipital region (where SSVEP responses are strongest). Step 3: Power Spectral Density (PSD) Analysis
Purpose: To verify that the EEG data contains the expected frequency components corresponding to your SSVEP stimuli. Compute PSD using FFT: Analyze the power spectral density to identify peaks at the stimulation frequencies (e.g., 5 Hz, 10 Hz, 15 Hz, etc.) and their harmonics. Expected Result: Clear and prominent peaks at the specific SSVEP stimulation frequencies, indicating a strong neural response to the flickering stimuli. Validation: Absence of peaks or weak signals at these frequencies could mean that the EEG recording is not capturing the SSVEP properly or that the subject's response is not consistent. Step 4: Signal-to-Noise Ratio (SNR) Calculation
Purpose: To quantify how strong the SSVEP signal is relative to the background noise. Calculate SNR: Measure the ratio of the signal power at the target frequencies to the noise power in neighboring frequency bands. Validation: High SNR values at the target frequencies indicate a reliable SSVEP signal, suitable for further analysis. Low SNR may suggest data contamination or poor neural response. Step 5: Time-Frequency Analysis
Purpose: To observe how the power at the target frequencies changes over time during the experiment. Perform time-frequency analysis (ERSP): Check for increases in power at the stimulation frequencies during the periods when the stimuli were presented. Validation: Ensure that power increases align with the time windows when the SSVEP stimulus was shown. If no clear response is observed, it may indicate signal quality issues. Step 6: Phase Coherence and Consistency Check
Purpose: To ensure that the phase of the EEG signal is consistently aligned with the flickering stimulus. Calculate Phase-Locking Value (PLV) or Inter-Trial Coherence (ITC): These measures indicate how consistently the EEG signal is phase-locked to the stimulus frequency. Validation: High coherence indicates that the brain's response to the stimulus is stable across trials, which is essential for accurate SSVEP-based analysis. Step 7: Topographic Analysis
Purpose: To confirm that the SSVEP response is predominantly generated in the visual cortex area. Create topographic maps: Visualize EEG activity over the scalp to ensure the strongest signals are in the occipital region (at the back of the head). Validation: If the SSVEP response appears elsewhere or is not focused on the occipital region, it could indicate potential noise or artifacts. Step 8: Statistical Analysis of Data Quality
Purpose: To perform a quantitative check to compare the EEG signal during the stimulus period with a baseline period. Run statistical tests: Use paired t-tests or ANOVA to compare the power at the stimulus frequencies against baseline (pre-stimulus) levels. Validation: Significant differences between the stimulus and baseline periods suggest that the EEG data contains the desired neural responses. Step 9: Consistency Check Across Trials and Subjects
Purpose: To ensure that the data quality and responses are consistent across multiple trials and subjects. Compare the frequency response and SNR across trials: Make sure that the response to the SSVEP stimulus is consistent. Check inter-subject variability: Assess how similar the EEG responses are across different subjects. Validation: Large variations in responses may indicate individual differences or inconsistencies in the data collection process. Recommended Tools for EEG Analysis
EEGLAB (MATLAB): Ideal for artifact removal using ICA, visualization of power spectra, and topographic mapping. MNE-Python: Provides robust functions for PSD analysis, SNR calculation, and time-frequency analysis. FieldTrip (MATLAB): Offers advanced EEG analysis methods, including phase coherence and statistical analysis.