Deep Learning Models for EEG-based Affective Computing
Overview
This chapter provides a comprehensive survey of deep learning architectures applied to EEG-based affective computing. It covers both discriminative models (classifying or regressing emotional states from EEG) and generative models (learning the underlying distribution of EEG signals for augmentation, denoising, and representation learning). We progress from foundational architectures through generative paradigms to trending frontiers.
Chapter Structure
Part I: Discriminative Architectures (Sections 1–6)
Multi-Layer Perceptrons (MLPs) (Section 01): The foundation
- Fully connected architectures for hand-crafted EEG features
- Strong baseline with frequency-domain and statistical features
Convolutional Neural Networks (CNNs) (Section 02): Spatial-temporal patterns
- Automatic feature extraction from raw EEG and spectrograms
- Captures local channel and temporal dependencies
Recurrent Neural Networks & LSTMs (Section 03): Temporal dynamics
- Sequential processing of EEG time series
- Long-term memory for emotional state evolution
Transformer Models (Section 04): Parallel attention
- Self-attention for global temporal patterns
- Efficient parallel training, strong with large datasets
Hybrid Architectures (Section 05): Combining paradigms
- CNN-LSTM, attention-enhanced, multi-task, ensemble methods
- State-of-the-art practical performance
Graph Neural Networks (GNNs) (Section 06): Brain network structure
- Channel connectivity modeling via anatomical/functional graphs
- Highly interpretable, neuroscience-aligned
Part II: Generative Models (Sections 7–9)
Variational Autoencoders (VAEs) (Section 07): Probabilistic latent models
- Structured latent space, disentanglement (β-VAE), conditional generation (CVAE)
- Semi-supervised learning, anomaly detection, emotion interpolation
Generative Adversarial Networks (GANs) (Section 08): Adversarial generation
- Sharp, realistic EEG generation (WGAN-GP, CGAN)
- Data augmentation, cross-subject translation (CycleGAN), artifact removal
Flow-based and Diffusion Models (Section 09): Frontier generative models
- Flow: exact likelihood, invertible mappings (RealNVP, Glow)
- Diffusion: state-of-the-art generation and denoising (DDPM, DDIM, LDM)
Part III: Emerging Frontiers (Section 10)
- Trending Architectures (Section 10): The cutting edge
- KAN, Mamba/SSM, SNN, Foundation Models, Hypernetworks
- Emerging paradigms reshaping EEG deep learning
Part IV: Continuous and Operator Learning (Sections 11-12)
Neural Operator Learning (Section 11): Function-to-function models
- DeepONet, Fourier and wavelet neural operators, graph neural operators
- Continuous signal transformation, spatial querying, cross-montage transfer, and neural fields
Neural Ordinary Differential Equations (Section 12): Continuous-time dynamics
- Neural ODEs, latent ODEs, ODE-RNNs, neural CDEs, neural SDEs, and continuous normalizing flows
- Irregular sampling, continuous affect tracking, and graph-aware neural dynamics
Part V: Efficient Deployment (Section 13)
- Knowledge Distillation (Section 13): Teacher-student transfer
- Soft targets, feature matching, attention transfer, and relation distillation
- Compact, wearable-ready EEG models with matched efficiency and generalization evaluation
Generative vs. Discriminative Approaches
| Aspect | Discriminative Models | Generative Models |
|---|---|---|
| Objective | — predict label given EEG | or — model EEG distribution |
| Output | Emotion class or regression value | Generated EEG, latent representation, or label |
| Data augmentation | External methods needed | Built-in generation capability |
| Interpretability | Attention maps, feature importance | Latent space traversal, factor disentanglement |
| Robustness to noise | Requires clean training data | Can learn to denoise and reconstruct |
| Training complexity | Relatively simpler | Often more complex, can be unstable |
Key Concepts
Latent Variable Models
Generative models often assume observed EEG data is generated from unobserved latent variables :
The latent captures essential factors — emotional state, subject identity, noise level — in a compressed form.
The Generative Process
- Sample latent: (e.g., standard Gaussian)
- Generate observation: (decoder/generator network)
- Inference: Given observed , infer (encoder network)
Applications in Affective Computing
| Application | VAE | GAN | Flow/Diffusion |
|---|---|---|---|
| Data augmentation | ✓ Good | ✓✓ Excellent | ✓ Good |
| Denoising / Artifact removal | ✓✓ Excellent | ✓ Good | ✓✓ Excellent |
| Cross-subject translation | ✓ Good | ✓✓ Excellent | ✓ Moderate |
| Latent representation learning | ✓✓ Excellent | ✓ Moderate | ✓ Good |
| Conditional generation | ✓✓ Excellent | ✓✓ Excellent | ✓✓ Excellent |
| Anomaly detection | ✓ Good | ✓✓ Excellent | ✓✓ Excellent |
| Missing channel imputation | ✓✓ Excellent | ✓ Good | ✓ Good |
Preprocessing for Generative Models
Unlike discriminative models, generative models require careful preprocessing to ensure generated outputs are realistic:
1. Signal Standardization
# Per-channel z-score normalization (reversible)
for ch in range(n_channels):
mean_ch = signal[:, ch].mean()
std_ch = signal[:, ch].std()
signal[:, ch] = (signal[:, ch] - mean_ch) / std_ch
# Store mean_ch, std_ch for inverse transform
2. Spectrogram / Time-Frequency Representation
Generative models often work better on 2D representations:
# Convert to spectrogram for CNN-based generators
from scipy import signal as scipy_signal
f, t, Sxx = scipy_signal.spectrogram(
eeg_signal, fs=256, nperseg=256, noverlap=192
)
# Sxx shape: (n_channels, n_freq, n_time)
3. Segmentation
# Fixed-length segments for stable training
segment_length = 2048 # ~8 seconds at 256 Hz
segments = sliding_window(eeg_signal, segment_length, stride=512)
# segments shape: (n_segments, n_channels, segment_length)
4. Normalization Considerations
- VAE: Often uses or standardized inputs for Gaussian likelihood
- GAN: Tanh output layer expects ; scale inputs accordingly
- Diffusion: Data scaled to for stable noise schedule
Evaluating Generative Models for EEG
Standard metrics adapted for EEG:
| Metric | What It Measures | EEG-Specific Consideration |
|---|---|---|
| FID (Fréchet Inception Distance) | Distribution similarity | Needs EEG-specific feature extractor (not ImageNet) |
| Reconstruction MSE | Signal fidelity | Window-level or channel-level |
| Classification accuracy on generated data | Utility of augmented data | Train classifier on generated EEG, test on real |
| Latent space smoothness | Interpolation quality | Linear interpolation in should yield smooth EEG transitions |
| Disentanglement metrics (MIG, DCI) | Factor separation | Separate emotion from subject identity |
| Spectral similarity | Frequency content match | PSD correlation, band power ratios |
Practical Guidelines
- Start with VAEs for representation learning and reconstruction
- Use GANs when data augmentation is the primary goal
- Adopt diffusion models for denoising and high-quality generation
- Always validate generated EEG with neuroscience domain experts
- Combine approaches: VAE-GAN hybrids offer the best of both worlds
- Consider computational budget: Diffusion models are the most expensive