Assessing Robustness of EEG Representations under Data-shifts via Latent Space and Uncertainty Analysis
Anonymous Author(s)
AffiliationAddress email
Abstract
The recent availability of large datasets in bio-medicine has inspired the development of representation learning methods for multiple healthcare applications.
Despite advances in predictive performance, the clinical utility of such methodsis limited when exposed to real-world data.
Here we develop model diagnosticmeasures to detect potential pitfalls during deployment without assuming accessto external data.
Specifically, we focus on modeling realistic data shifts in electrophysiological signals (EEGs) via data transforms, and extend the conventionaltask-based evaluations with analyses of a) model’s latent space and b) predictiveuncertainty, under these transforms.
We conduct experiments on multiple EEG feature encoders and two clinically relevant downstream tasks using publicly availablelarge-scale clinical EEGs.
Within this experimental setting, our results suggest thatmeasures of latent space integrity and model uncertainty under the proposed datashifts may help anticipate performance degradation during deployment.
Introduction
In recent years the availability of large datasets in bio-medicine has inspired the development of deeprepresentation learning methods for diagnostic applications in healthcare domains such as cardiology,neurology and radiology, to name a few.
However, there are increasing examples of failures ofsuch systems during real-world deployment, predominantly due to dataset/distribution shifts in thedeployment setting (1; 2; 3; 4; 5; 6).
Currently, the most common approach undertaken to evaluatehealthcare machine learning (ML) models is analyzing task performance in a held-out test dataset.
The recent advances in covariate-shift detection and adaptation approaches (7; 8; 9; 10; 11) havenot been widely adopted in the healthcare ML community because they do not reflect the uniquehealth-data-related challenges.
As such, the practical value of many healthcare ML models remainsunclear at present without additional assessments of model resilience in deployment settings (12).
This gap reflects a major hurdle in translating healthcare ML models as they are required to performconsistently under varying noise characteristics, diverse data acquisition protocols and multiple sitesand populations, during deployment.
Hence, there is a critical need to evaluate the robustness ofhealthcare ML models under realistic dataset shifts prior to deployment.
In this paper, we focus on a particular area of healthcare ML pertaining to learning representations ofphysiological signals such as electroencephalograms (EEGs).
EEGs are commonly used to diagnosevarious neurological, psychiatric, and sleep disorders, as well as in applications involving brainmachine interfaces.
Deep representation learning of raw EEG signals has recently gained popularitybecause of the availability of large-scale EEG datasets (13) and has shown promise in improving thelabor-intensive and error-prone manual process undertaken in clinical EEG reviews.
A variety ofapproaches have been proposed including, fully-supervised deep feature encoders (14; 15; 16), selfsupervised encoders (17; 18; 19), and traditional feature-based encoders using power spectral features(20).
However, many of those approaches struggle to generalize to previously unseen real-world data,i.e., data acquired from different populations, institutions, or devices (21; 22).
We believe that a multi-pronged approach is necessary to holistically evaluate the robustness ofhealthcare ML models prior to deployment.
First, models of realistic data shifts are needed to assessrobustness during model development itself.
For instance, realistic EEG data shifts may includedifferences in behavioral states during EEG acquisition (awake or asleep), the number of EEG sensorsused, the EEG reference used, noise during acquisition, analog-to-digital conversion, hardware filtersettings, and impedance resulting from electrodes.
Second, we argue that robustness evaluationsmay also benefit from analyzing the properties of the latent embedding space (7).
Specifically,quantifying the topological changes in the latent space under perturbations can, 1) provide early cluesinto test set performance when ground truth labels are not available; and 2) indicate failure modesof model interpretation techniques that rely on analyzing similarity properties in the latent space.
Third, we highlight the need for estimating the uncertainty in model predictions at the output layer(23).
Uncertainty modeling is critical in ensuring the safe and reliable use of healthcare models sinceaccurate communication of uncertainty allows human experts to selectively ignore the model.
In this study, we evaluated the robustness of several previously proposed EEG feature encoders usingthe above multi-pronged approach.
Specifically, we introduced four EEG signal transformations thatmodel the effects of instrumentation-related real-world EEG variability, namely: hardware band-passfilters, quantization precision, narrow-band impedance noise, and broad-band Gaussian noise.
Next,we developed a topological measure of latent space integrity based on Delaunay neighborhood graphs(adapted from (24)) and a Monte Carlo dropout-based approach to estimate predictive uncertainty.
Inthis setting, we then evaluated fully-supervised, self-supervised, and traditional feature-based EEGencoders in both classification and regression tasks.
Our major contributions are the following:
We developed four domain-guided EEG data shifts (EEG-DS) reflecting instrumentation-
related variability observable in real-world deployment.
Using EEG-DS, we devised a multi-pronged approach to evaluate the robustness of multipleML models
including assessments of latent space integrity and predictive uncertainty.3.
Using two large-scale EEG datasets (TUH (13) and NMT (25)), we show that the proposedapproach can help anticipate in-the-wild performance during model development itself andthat popular EEG encoders exhibit variable robustness profiles.
Related Work
Generalization to unseen data : The importance of generalization in healthcare ML is widelyacknowledged (1; 5; 6; 26).
Prior work in general ML has proposed, a) methods to detect covariateshift or out-of-distribution samples (7; 27; 28); and b) novel learning approaches that generalize wellor adapt to new domains (29; 30; 31; 8; 9; 10).
However, the majority of the adaptive approachesrequire examples from target distributions and therefore have limited utility.
Some methods to detectcovariate-shift focus on specific properties such as non-stationarity (27; 28), which are simplisticand do not reflect the complexity of healthcare data and shifts.
In this paper, we focus on detectingfailure modes prior to deployment via topological analysis of the latent space and evaluation ofmodel uncertainty under realistic data shifts.
In this context, the closest to our work is (7), whereauthors used measures such as Wasserstein’s distance for detecting data shifts in the latent spacefor vision and language tasks.
Here we develop a more comprehensive topological evaluation ofthe latent space using Delaunay neighborhood graphs and use it to analyze the robustness of scalp
EEG representations.
In addition, some recent studies have highlighted the benefits of uncertaintyquantification in out-of-distribution settings, in knowing when not to trust a model’s predictions (32).
Some studies have also indicated that certain types of representation learning approaches exhibitbetter robustness in terms of predictive uncertainty than others (33).
Building on these insights, weutilized a Monte Carlo dropout (MCD)-based uncertainty quantification to analyze the predictiveuncertainty of different EEG feature encoders under specific data shifts.
Data shifts in EEG data: Several previous studies have analyzed the performance of EEG MLmodels using datasets from multiple institutions (21; 22; 34).
Apart from reporting differences inmodel performance, these studies did not investigate approaches to identify failure modes prior todeployment, model data shifts, or generate insights for future studies.
Some studies have developeddata augmentations for EEG signals to improve the diversity of training data and have demonstratedsome success in achieving better task performance (18; 35; 36).
While augmentations such asamplitude scaling, time shift, DC shift, and band-stop filtering are useful to increase training data diversity (18), they do not meet the complexity of real-world EEG signal variability observed indeployment settings.
Hence, in this paper, we focus on developing domain-guided data shiftsobservable in deployment settings as opposed to simpler training time data augmentations.
EEG feature encoders: A variety of EEG feature encoders have been proposed including, fullysupervised deep encoders (14; 15; 16), self-supervised encoders (17; 18; 19), and traditional domainderived feature encoders using power spectral features (20; 37).
While the generalization capabilitiesof the majority of these encoders are unclear, an encoder derived based on self-supervised learninghas shown promising trends in generalization when specific domain-derived self-supervision taskswere utilized (17).
However, a comprehensive robustness evaluation of the different types of EEGfeature encoders under realistic EEG data shifts is currently lacking.
Background & Methods
In this section, we describe the formulations of multichannel EEG data, feature encoders, and theproposed robustness evaluation approach including realistic EEG data shifts (EEG-DS), latent spaceanalysis, and uncertainty quantification.
The proposed approach does not require additional data orlabels obtained in deployment settings and therefore is applicable during model development.
3.1 Learning EEG data representations
We use x i ∈ R M × N to denote the EEG data of a single epoch recorded using M sensors with N samples (i.e., N = time duration × sampling frequency).
Typically, a full EEG recording consists of multiple such non-overlapping epochs.
Consider a feature encoder f θ : R M × N → R d that maps a multi-channel EEG epoch
x i into a d -dimensional latent representation z i ∈ R d , where z i =
f θ ( x i ) .
In traditional supervised learning, f θ is trained jointly with a classification or regression head g ϕ ( . ) to predict the desired target
y i with the following learning objective.
[Equation]
where L is a loss function.
However, in representation learning (e.g., self-supervised learning), f θ is first pretrained using a different objective to obtain a feature extractor f θ ∗ , which produces a latent embedding for a given input.
Classification or regression heads g ϕ ( . ) can then be trained using the latent embeddings keeping f θ ∗ fixed, where the learning objective takes the following form.
[Equation]
3.2 Realistic data shifts in EEG data
In this study, we focus on modeling data shifts in EEG datasets caused by real-world variability.
Consider the training (i.e., source) data domain p s ( x ) and the real-world data domain (i.e., target)p t ( x ) , where x is input data.
Covariate shifts are defined when the concept mapping g ϕ ◦ f θ : x → yremains unchanged, resulting in the same conditional distribution of labels i.e., p s ( y | x ) =
p t ( y | x ) .
However, the marginal distributions of data are assumed to change i.e., p s ( x ) ̸ = p t ( x ) .
In thisstudy, we assume no access to external labels or additional data from the real-world.
Instead, wesynthetically construct the target domain p t ( x ) based on an expert understanding of the EEG signalacquisition process via a set of EEG data transformations T .
Therefore, within the scope of thecurrent study, p t ( x ) = p s ( T ( x )) , and the proposed robustness assessment approach can be viewedas quantifying the differences between p s ( x ) and p s ( T ( x )) through a set of metrics M .
The effects of real-world variability on EEG segments can be modeled using a data transformationfunction t : R M × N → R M × N , where ˜ x = t ( x ) represents a shifted EEG sample.
Real-world EEGdata shifts may occur due to differences in populations, behavioral states (e.g., awake, asleep), thenumber of EEG sensors used, the EEG reference used, noise during acquisition, analog-to-digitalconversion, hardware filter settings, and impedance resulting from electrodes.
However, here we focuson data shifts induced by acquisition conditions and assume that other variables are controlled.
Inthat context, we develop four EEG transformations: 1) band-pass filter t BP , 2) quantization precisiont QP , 3) narrowband impedance noise t IN , and 4) broadband noise t BN (summarized in Table 1).
[Table]
Band-pass filter: EEG device manufacturers commonly implement hardware-level band-pass filters
[Table]
in order to restrict the spectral content of the acquired signal.
However, those filter settings may varybetween different manufacturers and devices.
Hence, we define a data shift t BP to reflect the effectsof different band-pass filter settings such as, 0.5–30 Hz, 1–30 Hz, and 1–25 Hz.
Quantization precision: In commercial EEG devices, resource constraints limit the precision of therecorded EEG data and the analog signal is digitized with variable number of bits.
We implementthis effect as a truncation of decimal digits to either 6, 8, or 12 points and denote it using t QP .
Signal noise: The acquisition of EEG signals is highly susceptible to multiple sources of noiseand artifacts: subject movement-related sources in the form of eye blinks, head movement, jawclenching, etc., environmental sources such as AC power line interference, and instrumentationrelated sources such as electrical impedance due to poor sensor contact with the scalp.
We use t INto model electrical impedance noise due to poor sensor contact or choice of dry/wet electrodes thatmanifests as narrow-band low-frequency (0–1 Hz) random noise in the EEG signal (38) with differentstrengths ( σ ∈ { 0 . 001 , 0 . 01 , 0 . 1 } ).
Next, we use t BN to capture random physiological noise that maymanifest as broadband (0–45 Hz) noise with different strengths ( σ ∈ { 0 . 001 , 0 . 01 , 0 . 1 } ).
3.3 Topological analysis of the latent space
Here we aim to quantify the distortion in latent space caused by input data transforms, i.e., differencesbetween z
= f θ ( x ) and ˜ z
= f θ ( T ( x )) .
Some previous studies have utilized distance metrics suchas Wasserstein’s distance to quantify the differences (7).
Here we employ a more comprehensiveapproach adapted from (39) and (24), where we estimate a manifold that contains point cloudscomprising the latent representations { z i } and { ˜ z i } and conduct a geometric/topological analysis onthis estimated manifold.
We estimate the manifold based on Delaunay neighborhood graphs, whichconnect spatial neighbors in a way that captures local point density as well as global outliers (24).
Suppose we use Z ∈ R d and ˜ Z ∈ R d to denote the sets including all embeddings of raw andtransformed input data, respectively, and define a set of vertices V =
{ Z ∪ ˜ Z } .
Then, the Voronoicell of v ∈ V is the set of points in R d for which v is the closest among V , i.e., Cell ( v ) = 153 (cid:8) x ∈ R d | ∥ x − v ∥ ≤ ∥ x − v i ∥ ∀ v i ∈ V (cid:9) .
Then, we define edges E by connecting points v
i andv j whose Voronoi cells intersect, i.e., E = { ( v i , v
j ) ∈ V × V | Cell ( v i ) ∩ Cell ( v j ) ̸
= ∅ , v i ̸
= v j } .
This set of vertices V and edges E form the neighborhoods in the Delaunay graph G =
( V , E ) .
Intuitively, the points in V that share a Voronoi cell boundary are considered natural spatial neighborsirrespective of the distance between them.
This property of Delaunay neighborhoods enables robustmanifold estimation even when point density varies locally and outlier points exist.
Notably, thesespatial neighbors or edges can emerge in a way that connects points in Z to points in ˜ Z
(denotedby R and E respectively in (24)).
Such edges can be considered ‘heterogeneous’, as opposed to‘homogeneous’ edges which connect two points belonging to the same set.
The degree of edgeheterogeneity of G can be measured by a simple quality measure (39) q ( G ) defined in Equation 1.
In Equation 1, (cid:12)(cid:12) G Z (cid:12)(cid:12) E and (cid:12)(cid:12)(cid:12) G ˜ Z (cid:12)(cid:12)(cid:12) E denote the number of homogeneous edges within G belonging to
Z and ˜ Z , respectively, and |G| E denotes the total edges in G .
Therefore, if G exclusively contains homogeneous edges, q ( G ) = 0 , and if all edges are heterogeneous, then q ( G )
= 1 .
In this work, weuse the degree of edge heterogeneity, q ( G ) , as a measure of latent space integrity between un-shiftedand shifted samples under perturbations T . A visual intuition of q ( G ) is provided in appendix.
[Equation]
3.4 Quantifying model uncertainty using Monte Carlo dropout
In this work, we use a Monte Carlo dropout (MCD) strategy to examine per-sample variability in predictions, as a measure of model ‘uncertainty’ for a new sample (23).
Specifically, we directly comparethe changes in model uncertainty (measured using the standard deviation) under the aforementioned
EEG-DS.
Here we briefly summarize the theoretical background and our implementation.
In the Bayesian setting, the predictive distribution of a model f with parameters θ for an input x
andoutput ˆ y is expressed as p (ˆ y | x, D ) =
(cid:82) p (ˆ y | x, θ ) p ( θ | D ) dθ , where D is training data.
Becauseexact computation of this expression is intractable, we perform approximate inference using a variational distribution.
A previous study showed that training neural networks with Bernoulli dropoutvariables is equivalent to approximate inference of the posterior of model parameters (23).
With T setsof Bernoulli realizations of θ { θ t } Tt =1 , the Monte Carlo estimate of the mean prediction and its variance are computed as E [ˆ y | x ] ≈ 1 T (cid:80)
Tt =1 f ( x, θ t ) and V ar (ˆ y | x ) ≈ 1 T (cid:80)
Tt =
( f ( x, θ t )
− E
[ˆ y | x ]) 2 .
In our experiments, we used a dropout probability of c = 0 .
5 and repeated forward passes T =
20times to estimate the mean and variance of predictions ˆ y .
We then compare the standard deviation andthe agreement index of the predictions to make conclusions about predictive uncertainty of regressionand classification tasks, respectively.
The agreement index between multiple Monte Carlo dropoutsfor a threshold τ t is defined as, ϕ = 1 T (cid:80)
Tt =1 1 { f ( x, θ t ) ≥ τ t } .
Experimental Setup
Our overall experiment setup is illustrated in Figure 1.
Using raw EEG signals and their shiftedversions under transforms EEG-DS introduced in Section 3.2, we evaluate the robustness of EEGencoders in both in-sample and out-of-sample data.
Through our experiments, we hope to answerthe following questions: a) do latent space analysis and predictive uncertainty help anticipate modelbehavior in deployment settings?
, b) what types of real-world EEG data shifts impact model robustnessthe most?, and c) do some encoders exhibit better robustness than others?
In the following, we brieflydescribe the components of our evaluation setup: the EEG datasets, preprocessing steps, EEG featureencoders, learning tasks, data splits, and evaluation metrics.
[Figure]
EEG dataset & preprocessing: We utilize EEG data from two large-scale databases, TUH-EEGdatabase from Temple University Hospital (13) and NMT database from Pak-Emirates Military
Hospital (25).
For our experiments, we utilize [-the TUAB recordings, containing a total of 
-]2,993 EEGs from TUH-EEG (a subset known as TUAB) and 1,369 EEGs from the NMT database, both of which contain normal and abnormal labels.
All EEGs were recorded according to the standard 10-20 montage (40).
We extracted age labelsfrom text reports accompanying the EEG recordings using a previously published tool (41).
Next,we preprocessed the EEGs as follows: a) we ordered the EEG channels as ‘Fp1’, ‘Fp2’, ‘F3’, ‘F4’,‘C3’, ‘C4’, ‘P3’, ‘P4’, ‘O1’, ‘O2’, ‘F7’, ‘F8’, ‘T7’, ‘T8’, ‘P7’, ‘P8’, ‘Fz’, ‘Cz’, and ‘Pz’, b) resampledthe recordings to 128Hz, c) applied a bandpass filter between 0.5Hz and 45.0Hz, d) divided therecordings into contiguous non-overlapping epochs of 10-seconds each, e) identified and removedbad epochs when the total power in their ‘Cz’ channel exceeded 2 standard deviations as calculatedfrom statistics of each recording, f) clipped amplitude values to not exceed ± 800 µ V, and finallyg) we normalized the recording per-channel using the identified valid epochs.
Note that whenevertransforms T were utilized, they were applied directly on the raw data before preprocessing.
EEG encoders: We train three diverse types of raw EEG encoders: fully-supervised, self-supervised,and traditional feature-based.
The fully supervised encoders (FSE) were based on the widely used‘ShallowNet’ architecture (14) with additional classification and regression heads described below.
The self-supervised encoder (SSE) also utilized the ‘ShallowNet’ architecture with pre-trainingperformed using a proxy measure of the patient’s behavioral state (17).
Finally, we utilized a powerspectral-density-based encoder (PSDE) with EEG spectral power calculated within 7 frequency bands:δ (2-4Hz), θ (4-8Hz), low α (8-10Hz), high α (10-13Hz), low β (13-16Hz), high β (16-25Hz), andγ (25-40Hz) for each of the 19 channels.
Both FSE and SSE took raw EEG traces as inputs andproduced 128-dimensional embeddings, while PSDE generated 19 × 7 = 133 features.
We utilized additional classification and regression heads to develop task-specific predictors using theabove encoders.
Note that we trained FSE entirely using the task labels, whereas we fine-tuned SSEby training the classification/regression layer while keeping the encoder network frozen.
In addition,we employed dropout with p = 0 .
5 in all heads and used a binary cross-entropy loss and a smoothvariant of the mean absolute error loss for training the classification and regression heads, respectively.
We trained the models up to a maximum of 500 epochs and while monitoring convergence usinga validation set of 373 EEGs.
We used either Adam or SGD with a cyclic learning rate scheduler(42) optimizer.
The full set of hyper-parameter values are provided in the appendix and are alsodocumented within code released as a URL therein.
Classification and regression tasks:
We utilized meaningful classification and regression tasksto evaluate the robustness of above encoders.
EEG grade classification as ‘normal’ or ‘abnormal’is a common task performed by clinical experts via visual review.
Performing such classificationusing ML approaches in an automated fashion is of great interest since it has the potential to reducethe workload of clinical experts.
Next, the potential to predict an individual’s age using EEGs, aregression task commonly known as brain age prediction, is useful because it can indicate deviationsfrom healthy brain aging and therefore help with early diagnosis of neurodegenerative diseases.
Hence, we utilized two tasks: a binary classification task classifying EEG grades as ‘normal’ or‘abnormal’ and a regression task predicting brain age from EEGs, to conduct our experiments.
Training, validation, and testing: We split TUAB into fixed training (1,490 EEGs; 258,631 epochs),validation (373 EEGs; 68,493 epochs), and held-out test (466 EEGs; 82,331 epochs) sets.
Furthermore,we performed all model training on TUAB at the epoch level without any shifts.
Since both EEGgrade and age are recording-level measures, during evaluation, we aggregate epoch-level predictionsby averaging the predictions across all epochs in a recording (17; 20).
In-sample and out-of-sample evaluations: We evaluated the robustness of EEG encoders in thein-sample setting by comparing performances between the modified and unmodified TUAB test set.
We evaluated the out-of-sample performance using the external NMT dataset, while restricting theevaluations to data from adults (18+) to avoid any physiological variability unseen during training.
Evaluation metrics: We perform all evaluations on the held-out test set.
The key metrics utilized toperform the proposed encoder assessments are described in Section 3.
Based on the graph constructionoutlined in Section 3.3, we interpret the measure of edge heterogeneity obtained using Equation1 as a score of integrity of the latent space under perturbation.
For each encoder, we compare therepresentations of raw EEG samples against their shifted versions in the latent space.
Next, we usepredictive uncertainty to analyze per-sample variability of encoders under dataset shifts.
Specifically,we analyze the median agreement index ( ϕ ) and standard deviation in model predictions obtained via MCD as measures of uncertainty.
Finally, we quantify task performance using the ground truth labels.
To analyze task performance, we use the area under the receiver operating characteristic curve (AUC) and the mean absolute error (MAE) metrics for EEG grade and brain age tasks, respectively.
Notethat we performed the analyses of the latent space using embeddings of all the epochs in the test setand analyzed task performance and uncertainty using aggregated EEG-recording level metrics.
Software & hardware:
The preprocessing, baseline features, and model training were implementedusing a combination of the following Python libraries: 1) MNE-python (43), 3) PyTorch (44), and 3)
NumPy (45).
Delaunay graph construction and analysis were performed using code released by (24).
The experiments were performed using 2 Nvidia RTX 3090 GPUs.
Results
Our results are summarized in Figures 2 and 3, and Table 2.
We performed latent space analysis anduncertainty quantification without using the ground truth labels and evaluated whether the changes inthose measures resulting from test-time data-shifts indicate performance degradation in the in-sampleand out-of-sample test sets.
In the following, we use the following acronyms to refer to the datashifts and encoders: BP - bandpass filter, QP - quantization precision, IN - impedance noise, BNbroadband noise, SSE - self-supervised encoder, FSE-grade - fully-supervised encoder fine-tunedon grade classification, FSE-age - fully-supervised encoder fine-tuned on age prediction, PSDEtraditional power-spectral density-based encoder.
[Figure]
Impact of data-shifts on predictions : Figure 2 shows an example of how model predictions areaffected when the proposed transformations are applied to the input data.
In the top row, we show acomparison of the predicted probability of EEG grade by the FSE encoder on held-out data underadditive broadband noise t BN of varying strength σ .
The probabilities are grouped along the x-axis byexpert labels.
We observe that the predicted probability distributions for the two ground truth classesoverlap more under stronger shifts.
In the bottom row, we show scatter plots of brain age predictedby FSE against the ground truth under similar comparison settings as above.
With stronger shifts, weobserve a collapse in the range of FSE predictions.
Evaluation of the latent space : Figure 3 shows the latent space integrity scores ( ↑ ) in the in-sample(lines) and out-of-sample (‘ × ’s) settings for multiple EEG encoders.
The same results are providedin a tabular form in the supplement including standard deviations.
First, we established an empiricalbaseline for ideal integrity scores by comparing un-modified data with itself for each encoder (labeledas ‘No shift’ in Figure 3).
Then we compared the in-sample integrity scores between the encoders byincreasing the strength of each data shift (left → right).
We find that all proposed data shifts affectthe integrity scores, albeit to varying degrees, with BN and QP being the most and least effective,respectively.
Interestingly, we also find that PSDE and SSE encoders produce better overall integrityin the latent space compared to others.
We then computed these scores between unmodified in-sample and out-of-sample test sets for 100 randomly chosen EEGs. We find that there are notable differencesbetween the two test sets, and that the representations generated by SSE preserve integrity the most.
N o s h
i f t f = [ 0 .
5 ,] f
= [ 1 ,] f = [ 1 ,] 0.
BP
N o s h
i f t D =
D =
D =
QP
N o S
h
i f t = 0 {+.= 
+}
.= 0 .
IN
N o S
h
i f t = 0 {+.= 
+}
.= 0 .
BN
SSE FSE grade FSE age PSDE Task performance & uncertainty:
Table 2 lists the task performance measures and the uncertaintymeasures for EEG grade classification and brain age regression tasks evaluated on the in-sample andout-of-sample test sets under different data shifts. For additional context, the same metrics computedon the train and validation sets are provided as supplement.
The task performance metrics reported arethe means of the recording-level AUCs and MAEs computed based on the 20 MCD repeats (standarddeviations are provided in the supplement).
Regardless of shift, we find that FSE outperforms both
SSE and PSDE in both tasks significantly.
However, SSE and PSDE exhibit consistent performanceunder perturbations in the age prediction task although their absolute performance is worse comparedto FSE.
Data shifts IN and BN affect all encoders in EEG grade classification, and BP, IN, and BNaffect FSE encoder in age prediction.
As measures of uncertainty, we report the average agreementindex in EEG grade prediction and the standard deviation of the predicted age values across {+
+} MCD repeats.
We find that both SSE and PSDE exhibit overconfidence in model predictions despiteachieving worse task performance than FSE in both tasks.
Next, all EEG-DS cause only marginalchanges on uncertainty measures and only the strongest BN ( σ = 0 . 1 ) causes a noticeable change.
The out-of-sample evaluation shows a universal degradation in both task performance and uncertaintymeasures across all encoders compared to the baseline. [Table] [Table]
[Table] [Table] [Table] [Table]
[Table]
[Table]
Discussion
[Table] The aim of this study was to develop model diagnostic measures for EEG feature encoders that helpanticipate deployment failures during model development itself.
We modeled real-world variability in EEG signals by designing four data shifts, i.e., EEG-DS (Table 1), that capture the effects of band-passfilter settings, analog-to-digital quantization precision, and manifestations of noise.
Then, we traineddiverse types of EEG encoders (self-supervised, fully-supervised, and conventional) on un-shifted data for two clinically important tasks (Section 4), and assessed their robustness under these shiftsduring model development.
Notably, we analyzed the encoders’ latent space (Figure 3) and predictiveuncertainty (Table 2) in a label-agnostic fashion, in addition to analyzing task performance (Table 2).
Finally, an evaluation using an external dataset indicated that the performance drop observed in theout-of-sample setting is proportional to what we observed in the above experiments.
The value of latent space analysis : If we consider task performance as gold-standard metric indeployment settings, the latent space analysis allows us to see ‘early’ signs that predict degraded taskperformance (Figure 3 and Table 2). The results of aggressive shifts (e.g., σ =0.1) in the in-sampleexperiments strongly correlated with the out-of-sample performance, highlighting the potential use ofthe latent space analysis.
Intuitively, a strong distortion in the latent space is likely to push samplesfrom one side of the decision boundary to the other, leading to worse performance.
The value of uncertainty quantification : Our uncertainty studies identify a major pitfall that ispossible to occur during deployment.
We found that both SSE and PSDE encoders were highlyconfident in their predictions although their task performances were much worse compared to FSE.
This might indicate that the SSE and PSDE encoders were not sufficiently trained to achieve desirabletask performances (i.e., classifier bias) and hence showed less variability in predictions.
On the otherhand, the uncertainty measures of the FSE encoder provided meaningful interpretations althoughthe changes in uncertainty under the proposed data shifts were marginal.
We believe that analyzingmeasures of uncertainty in conjunction with task performance can help assess real-world robustness.
Data shifts : Trends in Figure 3 indicate that a (1-25Hz) band-pass filter and strong additive broadbandor narrowband noise ( σ = 0 .
1 ) impact latent space the most.
Table 2 shows the same trend in taskperformance, although the effects are more pronounced in age prediction compared to EEG gradeclassification.
From an EEG perspective, sensitivity to band-pass filtering and noise is expectedsince they affect the spectral content of the signal, which is important for the tasks of EEG gradeclassification and brain age regression.
We found that the data shifts did not impact uncertaintymeasures all that much except for the strongest broadband noise ( σ = 0 . 1 ).
While we do not considerall sources of EEG shift, the fact that the proposed instrumentation-related shifts can anticipateout-of-sample performance suggests that they represent a good fraction of real-world diversity, andare indeed valuable in anticipating deployment failures.
EEG feature encoders : A general trend seen in Table 2 across all shifts is that FSE provides betterabsolute performance and that SSE and PSDE encoder performances are more stable.
This apparenttrade-off between absolute performance and robustness can be explained by considering the effectivemodel sizes (i.e., number of learnable parameters) in each setting.
Recall from Section 4 that only thelast linear layer g ϕ ( . ) is trainable for SSE and PSDE while the entire network g ϕ ( f θ ( . )) is trained incase of FSE.
Due to disproportionately higher number of parameters, FSE can apriori be expected toperform better than SSE and FSE.
However, this also implies that dropout in FSE would inactivate adisproportionately higher number of units, leading to less stable performance.
Limitations and future directions:
Besides instrumentation-related variability, data shifts originatingfrom physiological changes in brain activity (e.g., sleep) may also play a significant role in real-worldrobustness.
In future work, we will implement additional data shifts representing the physiologicalvariability in brain activity and investigate whether adversarial training and training with data shiftscould improve real-world robustness.
Conclusion
In this paper, we developed an approach to assess real-world robustness of EEG-ML models duringmodel development itself.
Our approach included implementation of realistic data shifts and evaluation of model robustness using a latent space topological analysis and quantification of predictiveuncertainty.
We developed four data shifts for EEG signals reflecting potential instrumentation-relatedvariability observable in the real-world.
We then performed experiments to evaluate differences inlatent space integrity, predictive uncertainty, and task performance, under the above data shifts andcorrelated the results with out-of-sample performance.
Within our experimental setting, includingthree EEG feature encoders, two downstream tasks, and two large-scale EEG datasets, our results empirically demonstrate that the proposed approach can help anticipate real-world performance duringmodel development itself. In future work, we will consider other plausible data shifts, adversarialtraining, and training models explicitly on realistic data shifts. Checklist For
all authors...
a) Do the main claims made in the abstract and introduction accurately reflect the paper’scontributions and scope? [Yes] The proposed data shifts for EEG signals are defined in Table 1, and results of latent space analysis and predictive uncertainty are summarizedin Figure 3 and Table 2, respectively. We highlight that this study does not propose anapproach to improve model robustness.
See Section 6 for summary of significance andscope of study.
(b)
Did you describe the limitations of your work?
[Yes] See Section 6 for discussion onlimitations of study and caveats in results.
(c)
Did you discuss any potential negative societal impacts of your work?
[No] Thisstudy introduces realistic data shifts and approaches that can anticipate model failuresand issues with model robustness before the model is deployed.
Therefore, proposedapproaches are strongly aimed at making a positive societal impact by attempting todetect costly real-world failures before they happen.
d
) Have you read the ethics review guidelines and ensured that your paper conformsto them?
Yes
] This study uses publicly available EEG data and corresponding textreports (13) that have been de-identified before release.
The dataset contains patientswith a wide variety of neurological disorders and diverse age and gender groups.
The training data used in our models reflects this diversity.
While the focus of ourstudy is evaluations of model robustness to EEG instrumentation-related shifts beforedeployment, we acknowledge that additional assessments are needed for clinical andprotected sub-groups of interest.
If you are including theoretical results...
(a) Did you state the full set of assumptions of all theoretical results?
[N/A]
(b) Did you include complete proofs of all theoretical results?
[N/A]
If you ran experiments...
(a) Did you include the code, data, and instructions needed to
reproduce
the
main
ex-
perimental
results (either in the supplemental
material
or as a URL
[Yes] We have
released
a sanitized version of all
code and instructions (i.e. anonymized for file pathsand other sources of identifiable information about authors) needed to reproduce resultsin Figure 3, Figure 2, and Table 2 as a URL in the appendix.
(b)
Did you specify all the training details (e.g., data splits, hyperparameters, how they werechosen)?
Yes
] Training details including data splits (train, validation, test) and majorhyperparameters are summarized in Section 4.
The complete set of hyperparametersare enumerated in the appendix, and are also documented in code.
(c) Did you report
error bars (e.g.,
with
respect to the random seed after running experiments multiple times)?
Yes
] Variability in model performance is a central theme ofthis study.
As such, the variability in model performance (due to Monte Carlo dropout)on the two EEG tasks is summarized in Table 2.
The supplement contains additionalvariability results that were omitted from the main text for sake of brevity.
(d) Did you include the total amount of compute and the type of resources used (e
g., type
of GPUs, internal cluster, or cloud provider)?
[Yes] See Section
for acknowledgement
of software and internal cluster
GPU hardware used for training the models. If you are using existing assets (e g., code, data, models) or curating/releasing new assets... (a) If your work uses existing assets, did you cite the creators?
[Yes] See Section
for
acknowledgement of authors
whose
code
we
built upon
(b) Did you mention the license of the assets?
[No] The code we have used is either a
publicly
released Python library or a GitHub repository with their respective open-
source
licenses.
(c) Did you include any new assets either in the supplemental material or as a URL?
[Yes]
We include links to anonymized code and instructions for replicating results as a URL
in the appendix.
(d) Did you discuss whether and how consent was obtained from people
whose
data you’re
(e) Did you discuss whether the data you are using/curating contains personally identifiable
[Table]
information or offensive content?
[N/A]
The public datasets used in this study were
[Table]
de-identified before release.
[Table]
If you used crowdsourcing or conducted research with human subjects...
[Table]
(a) Did you include the full text of instructions given to participants and screenshots, if
[Table]
applicable?
[N/A]
[Table]
(b) Did you describe any potential participant risks, with links to Institutional Review
[Table]
Board (IRB) approvals, if applicable?
[N/A]
[Table]
(c) Did you include the estimated hourly wage paid to participants and the total amount
[Table]
spent on participant compensation?
[N/A]
[Table]
Appendix
8.1 Visualization of latent space edge heterogeneity under dataset shift
[Figure]
Note that while the number of heterogeneous (grey) edges apparently increases, their proportionrelative to total edges, in fact, decreases.
This decrease in proportion lowers the proposed integritymeasure.
Out of the shifts shown in Figure 3 of the main text, broadband noise (BN; sigma=0.1) isaggressive enough to yield only homogeneous edges
[Table]
and the measure does indeed go to 0.
In the‘No shift (baseline)’ scenario, the number of homogeneous and heterogeneous edges is roughly equal,leading to an integrity score of approximately 0.
[Table]
8.2 List of training-related hyperparameters
[Table]
8.3 Link to code
Code and data required to reproduce results in Figure 2, Figure 3, and Table 2 is provided athttps://figshare com/s/