A Model Visualization-based Approach for Insight into Waveforms and Spectra Learned by CNNs

Charles A. Ellis, Robyn L. Miller, Vince D. Calhoun

TL;DR

This paper introduces a novel visualization-based method to understand what electroencephalography (EEG) signals deep learning models (CNNs) are learning, focusing on both spectral patterns and specific waveform shapes. By analyzing the first convolutional layer's filters, the approach offers unprecedented insight into how CNNs classify sleep stages, paving the way for more trustworthy and interpretable electrophysiology classifiers.

What Problem Does This Paper Address?

Deep learning, particularly Convolutional Neural Networks (CNNs), has shown great promise in analyzing complex electrophysiological data like EEG. However, these "black box" models make it difficult to understand why they make certain predictions. While existing methods often focus on spectral features (frequency content), they frequently overlook the crucial waveform shapes that are clinically significant in electrophysiology. This gap limits the trust and validation of these models, especially in critical applications like sleep stage classification where specific temporal patterns are key. The authors aim to bridge this gap by providing a method that visualizes and explains both the spectral and waveform features learned by CNNs from raw EEG data.

Methods

The core of this paper is a novel "model visualization-based approach" applied to the filters of the first convolutional layer of a CNN.

  • Spectral Clustering: The authors first analyze the spectral properties of each filter by performing a Fast Fourier Transform (FFT) and calculating power in 1 Hz intervals. They then use k-means clustering on these power values to group filters with similar spectral characteristics. This helps identify broad frequency bands that different filters are sensitive to.
  • Layer-wise Relevance Propagation (LRP): To understand the importance of each filter cluster for classifying different sleep stages, they employ LRP. This technique assigns a "relevance" score to each filter based on its contribution to the final classification decision for correctly classified samples. This allows them to quantify which filter groups are most influential for each sleep stage.
  • Filter Perturbation Analysis: This is presented as the key innovation. The authors iteratively "perturb" (modify) the weights of the filters in the first convolutional layer using a sliding window. By measuring the resulting change in the classifier's performance (weighted F1 score), they can identify specific time segments within a filter's receptive field that are critical for accurate classification. This allows them to pinpoint specific waveform shapes that the CNN has learned.

Datasets

The study utilizes the Sleep-EDF Expanded dataset from PhysioNet. This dataset contains 153 20-hour EEG recordings from 78 participants, sampled at 100 Hz. The data was preprocessed into 30-second segments and labeled into sleep stages: Awake, Rapid Eye Movement (REM), Non-REM 1 (NREM1), NREM2, and NREM3 (combining NREM3 and NREM4).

Key Insights and Ideas

  • Beyond Spectra: Waveforms Matter: The most significant insight is the demonstration that CNNs learn specific waveform shapes, not just spectral patterns, and that these waveforms are vital for accurate classification. This challenges the common focus on spectral features in EEG explainability.
  • Filter Specialization: The spectral clustering reveals distinct groups of filters specializing in different frequency bands, with one cluster showing a strong emphasis on lower frequencies (delta and theta) and another on higher frequencies (alpha, beta, gamma).
  • Critical Waveforms Identified: The filter perturbation analysis successfully identified specific time-domain patterns within filters that, when altered, significantly impacted classification performance. These patterns are hypothesized to correspond to clinically relevant EEG events like k-complexes and vertex spikes.
  • Importance of Long Filters: The authors emphasize that their approach is enabled by using longer filters in the first convolutional layer, which allows for the capture and visualization of more detailed waveform information compared to typical short filters.

Key Results

  • Classification Performance: The CNN achieved high performance for the Awake class (F1: 91.88±01.82), followed by NREM2 (F1: 79.20±01.67). NREM1 classification was found to be challenging, consistent with prior research.
  • Filter Importance: LRP analysis indicated that filters in Cluster 2 (specializing in delta and theta activity) were highly relevant, particularly for NREM3 classification.
  • Perturbation Impact: Perturbing filters in Cluster 2 (lower frequencies) had a more significant impact on classifier performance than perturbing filters in Clusters 0 and 1 (higher frequencies). This suggests that the lower-frequency waveform features learned by these filters are more critical for distinguishing sleep stages. Specifically, filters 21 and 26 showed the largest performance drops upon perturbation, potentially representing k-complexes and vertex sharp waves.

Limitations and Future Work

  • Focus on First Layer: The current analysis is limited to the first convolutional layer. Future work could extend this to deeper layers to understand how features are transformed.
  • Class-Specific Importance: The current analysis uses weighted F1 scores. Examining class-specific F1 scores could reveal if certain features are more important for distinguishing specific sleep stages.
  • Window Length Parameter: The filter perturbation analysis was conducted with a fixed window length (25). Investigating the effect of different window lengths is suggested for future work.
  • Spectral vs. Waveform Clustering: While spectral clustering was used to group filters, the authors acknowledge that it's a simplification and that true waveform-based clustering might be more informative. They suggest exploring methods like convolutional autoencoders for this.
  • Generalizability: While demonstrated on sleep stage classification, further validation on other electrophysiology modalities and tasks would be beneficial.

Summary updated

BibTeX
@inproceedings{ellis2022model,
  author = {Charles A. Ellis and Robyn L. Miller and Vince D. Calhoun},
  title = {{A Model Visualization-based Approach for Insight into Waveforms and Spectra Learned by CNNs}},
  booktitle = {EMBC},
  year = {2022},
  doi = {10.1109/embc48229.2022.9871414},
}

Loading related content...

Figure