Skip to content
Split data into 10 parts based on time (timestamps) and apply the train-test-val split for each part.
Shuffle training set.

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:
forward
23864
stop
17672
reverse
8534
turn_right
868
turn_left
452
There are no rows in this table
Validation set label distribution:
forward
5572
stop
3452
reverse
3707
turn_right
98
turn_left
21
There are no rows in this table
Testing set label distribution:
forward
6770
stop
4013
reverse
4694
turn_right
403
turn_left
180
There are no rows in this table

No sampling:

confusion_matrix.png
Screenshot from 2024-10-09 12-30-54.png
loss_plot.png
Screenshot from 2024-10-09 12-32-09.png

Class weights:

confusion_matrix.png
Screenshot from 2024-10-09 12-35-20.png
loss_plot.png
Screenshot from 2024-10-09 12-36-23.png

Undersampling:

confusion_matrix.png
Screenshot from 2024-10-09 12-25-00.png
loss_plot.png
Screenshot from 2024-10-09 12-26-07.png

Oversampling:

confusion_matrix.png
Screenshot from 2024-10-09 12-21-46.png
loss_plot.png
Screenshot from 2024-10-09 12-22-50.png

kfold cross validation:

Undersampling
confusion_matrix.png
loss_plot.png
Screenshot from 2024-10-09 12-46-59.png
Final Average Training Accuracy: 57.27% Final Average Testing Accuracy: 36.56%
Oversampling
confusion_matrix.png
loss_plot.png
Screenshot from 2024-10-09 13-09-50.png
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:
forward
230748
stop
128787
reverse
103378
turn_right
7646
turn_left
5482
There are no rows in this table
Validation set label distribution:
forward
54348
stop
34527
reverse
27077
turn_right
1564
turn_left
1504
There are no rows in this table
Testing set label distribution:
forward
75130
stop
44905
reverse
27077
turn_right
2420
turn_left
1760
There are no rows in this table

No sampling:

confusion_matrix.png
loss_plot.png
Screenshot from 2024-10-09 09-26-59.png

Screenshot from 2024-10-09 09-28-04.png

Class weights:

confusion_matrix_class_weights.png
Screenshot from 2024-10-09 09-30-36.png
loss_plot_class_weights.png
Screenshot from 2024-10-09 09-31-11.png

Undesampling:

confusion_matrix.png
Screenshot from 2024-10-09 09-44-17.png


loss_plot_undersampling.png
Screenshot from 2024-10-09 09-39-46.png

Oversampling:

confusion_matrix_oversampling.png
Screenshot from 2024-10-09 10-22-45.png


loss_plot_oversampling.png
Screenshot from 2024-10-09 10-22-26.png


kfold cross validation:

Undersampling
confusion_matrix.png
loss_plot.png

Screenshot from 2024-10-09 12-16-03.png
Oversampling

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.

PSD Before Preprocessing.png
PSD After ICA Artifact Removal.png
PSD After Notch Filtering.png
PSD After Bandpass Filtering.png
EEG Data After Normalization.png
combined_spectrogram.png

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.
Actions:
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.
Actions:
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.
Actions:
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.
Actions:
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.
Actions:
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.
Actions:
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.
Actions:
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.
Actions:
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.
Actions:
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.
Want to print your doc?
This is not the way.
Try clicking the ··· in the right corner or using a keyboard shortcut (
CtrlP
) instead.