Abstract
In recent years, several machine-learning (ML) solutions have been proposed to solve the problems of seizure detection, seizure phase classification, seizure prediction, and seizure onset zone (SOZ) localization, achieving excellent performance with accuracy levels above 95%. However, none of these solutions has been fully deployed in clinical settings. The primary reason has been a lack of trust from clinicians towards the complex decision-making operability of ML. More recently, research efforts have focused on systematized and generalizable frameworks of ML models that are clinician-friendly. In this paper, we propose a generalizable pipeline that leverages graph representation data structures as a flexible tool for graph neural networks. Moreover, we conducted an analysis of graph neural networks (GNN), a paradigm of artificial neural networks optimized to operate on graph-structured data, as a framework to classify seizure phases (preictal vs. ictal vs. postictal) from intracranial electroencephalographic (iEEG) data. We employed two multi-center international datasets, comprising 23 and 16 patients and 5 and 7 h of iEEG recordings. We evaluated four GNN models, with the highest performance achieving a seizure phase classification accuracy of 97%, demonstrating its potential for clinical application. Moreover, we show that by leveraging t-SNE, a statistical method for visualizing high-dimensional data, we can analyze how GNN’s influence the iEEG and graph representation embedding space. We also discuss the scientific implications of our findings and provide insights into future research directions for enhancing the generalizability of ML models in clinical practice.
Keywords: Electrophysiological signal processing, Graph neural networks, Health informatics
Subject terms: Computational biology and bioinformatics, Neuroscience, Neurology
Introduction
The processing of multichannel time series data is crucial in understanding many clinical disorders but can be very tedious. For example, epilepsy is a neurological disorder affecting over 50 million individuals worldwide1, often necessitating high capacity data collection in specialized units like the Epilepsy Monitoring Unit (EMU). Patients in these units undergo continuous video and multichannel electroencephalographic (EEG) monitoring, generating vast amounts of data-ranging from 1 to 10 terabytes per individual. Approximately 30–40% of these patients require intracranial EEG (iEEG) monitoring2,3, involving the implantation of electrodes within the brain to precisely locate seizure origins. For instance, the EMU at the Toronto Western Hospital annually manages about 300 patients for EEG recordings and nearly 40 patients for iEEG recordings.
Accurate seizure detection, seizure phase classification (e.g., preictal vs. ictal vs. postictal), and localization of seizure onset zones (SOZ) are crucial for effective treatment, particularly for those who are candidates for surgical intervention. Despite the significant volume of data generated, there is a lack of standardized methods for the automated processing, analysis, and interpretation of the multichannel time series data from EEG and iEEG tools, which hinders advancements in epilepsy treatment.
In recent years, machine-learning (ML) solutions have shown remarkable potential in automating the processing of multi-channel time series data, with some works achieving accuracy levels exceeding 99% for seizure detection, seizure phase classification, and SOZ localization in epilepsy management4–16. However, the full deployment of these technologies in clinical practice remains limited due to the lack of systematization, generalizability, and transparency in ML models. Clinicians require models that not only provide high accuracy but also offer understandable and actionable insights to inform their decisions.
In this paper, we develop a pipeline that leverages systematized data structures to analyze multichannel time-series data. Although generalizable to any multichannel time-series modality even beyond epilepsy, we apply our pipeline to the specific use case of automating seizure phase classification (preictal vs. ictal vs. postictal) from iEEG data and emphasize model integration of spectral and spatial dependencies among iEEG channels. By utilizing two comprehensive iEEG datasets17–19, comprising 23 and 16 subjects and 5 and 7 hours of iEEG recordings, we evaluate the performance of four different GNN architectures. Our results demonstrate that the highest-performing GNN model achieves a seizure phase classification accuracy of 97%, showcasing its potential for clinical application. Moreover, we employ t-distributed Stochastic Neighbor Embedding (t-SNE), a statistical method for visualizing high-dimensional data, to assess dynamics in the embedding space of our graph representation and pipeline.
The contributions of this paper are four-fold:
We introduce a generalizable GNN-based framework that utilizes customizable graph representation data structures, applying it for seizure phase classification from iEEG data
We conduct individual subject experiments on four GNN models built for seizure phase classification.
We demonstrate the application of t-SNE to provide qualitative analysis of the GNN and graph representation embedding space.
We discuss the clinical implications of our findings and propose future research directions to enhance the systematization and generalizability of ML models in clinical practice.
By integrating advanced GNN techniques with generalizable and customizable data structures, we aim to bridge the gap between high-performance ML models and their practical deployment in clinical environments, ultimately improving the management and treatment of disorders such as epilepsy.
Related work
In this section, we review recent advancements in EEG signal processing using graph neural networks (GNNs) in conjunction with deep learning (DL) methods, particularly focusing on seizure detection, phase classification, and localization. Convolutional neural networks (CNNs) have traditionally been effective in learning from EEG data. However, their fixed-grid architecture limits their ability to capture complex electrode connections20–24. Recent studies have explored integrating GNNs with CNNs to enhance the representation of EEG data by leveraging graph structures25.
Covert et al.4 introduced a temporal graph convolutional network (GCN) model tailored for automated seizure detection from scalp EEG data. Their approach emphasized extracting localized and shared features across temporal sequences, demonstrating progress in understanding electrode influence during decision-making processes.
Hassan et al.7 proposed an innovative method using feedforward neural networks (FfNNs) trained on multiband features derived from discrete wavelet transform (DWT) decomposition for epileptic seizure detection in EEG recordings. Meanwhile, Zeng et al.14 developed a GCN model achieving near-perfect accuracy in seizure prediction from scalp EEG signals, although concerns about overfitting were raised.
Lian et al.15 designed a joint graph structure and representation learning network aimed at optimizing graph structure and preictal feature representations for seizure prediction. Their focus on brain-computer interface (BCI)-aided neurostimulation systems highlighted the potential of integrating graph-based learning with clinical applications.
Zhao et al.8 introduced a linear GCN approach to enhance feature embedding of raw EEG signals during seizure and non-seizure periods, reporting robust performance metrics including accuracy, specificity, sensitivity, F1, and AUC scores.
Dissanayake et al.25 proposed a GNN model for seizure prediction using scalp EEG data, achieving state-of-the-art performance with over 95% accuracy. However, challenges in defining the prior graph for training highlighted ongoing methodological refinements needed in graph deep learning (GDL).
Li et al.9 developed a graph-generative network model for dynamic discovery of brain functional connectivity using scalp EEG. Their supervised learning approach classified between ictal and non-ictal states with 91% accuracy, showcasing advancements in understanding brain dynamics through graph-based models.
Jia et al.13 addressed the challenge of data volume in traditional DL models by employing a GCN model with 60-second windows to predict epileptic seizures from scalp EEG, aiming to make these technologies more suitable for wearable devices.
Liu et al.26 combined unsupervised and semi-supervised GCN methods for SOZ localization using iEEG data, demonstrating improved precision compared to traditional indices like the Epileptogenicity Index (EI)27 and Connectivity Epileptogenicity Index (cEI)28.
Grattarola et al.12 incorporated attention mechanisms into their GNN model for SOZ localization in epilepsy patients using iEEG recordings, identifying crucial brain regions associated with electrodes during interictal and ictal phases.
Wang et al.11 developed a Spatiotemporal Graph Attention Network (STGAT) based on phase locking values (PLVs) to capture connectivity information among EEG channels, demonstrating high accuracy, specificity, and sensitivity in temporal and spatial learning. Additionally, Wang et al.10 proposed a Weighted Neighbour Graph (WNG) representation for EEG signals, which aimed to reduce redundant edges by exploring different thresholding methodologies. Their study focused on improving the efficiency of graph-based EEG signal processing techniques.
Rahmani et al.29 combined meta-learning with GNNs to offer personalized seizure detection and classification using minimal EEG data samples, achieving promising results in accuracy and F1-score.
Pinto et al.5 reviewed explainability features in ML models for clinicians, emphasizing that model explainability itself does not build clinician trust. Rather, understanding model aspects including input feature selection, such as through systematized feature generation methods, is much more helpful in generating clinical interpretations and hypotheses.
Statsenko et al.16 evaluated a DL model for scalp EEG classification in binary and multi-class settings, exploring the influence of sampling rate and electrode number on model performance.
Raeisi et al.30 integrated CNNs with graph attention networks (GATs) for EEG data from neonatal subjects, achieving high accuracy in seizure detection by capturing critical channel pairs and brain interareal information flow.
Batista et al.6 investigated preictal changes in EEG data to predict seizures within 5 minutes of onset, highlighting challenges in real-life applications due to conservative alarm triggers.
There have been innovative developments in EEG data processing techniques and deep learning architectures. However, many of these models and data processing techniques are methodologically diverse, lacking standardization. This creates challenges in systematic feature selection, model development, pipeline evaluation, and clinician trust. Moreover, EEG data, although relatively convenient to collect, potentially lacks the resolution required to capture the complex neural signal patterns underlying epilepsy. Our study diverges from the aforementioned research by focusing on constructing generalizable and systematized graph representation (GR) data structures tailored to intracranial EEG (iEEG) data. Unlike previous works primarily centered on scalp EEG data, our emphasis on iEEG data offers superior resolution and volume, providing unprecedented insights into the intricate mechanisms underlying epilepsy. This strategic shift underscores the critical importance of leveraging iEEG data to advance our understanding and enhance clinical decision-making in epilepsy management. In addition, by employing generalizable GR data structures, we systematically conduct an analysis of various input features, signal processing techniques, and GNN architectures to derive optimal models for seizure phase classification. By leveraging a standardized and interpretable pipeline, we also provide insights into the underlying transformations behind complex deep learning models.
Methods and materials
On the data
OpenNeuro ds003029 dataset
We used a publicly available multi-centre dataset hosted at OpenNeuro with Accession Number ds00302917, which was first used in Li et al.31, where the authors proposed the metric of neural fragility as a biomarker of epilepsy that can be used for SOZ localization. All data were obtained with approval from the institutional review board (IRB) at each centre of data collection: IRB of the University of Maryland School of Medicine; University of Miami Human Subject Research Office-Medical Sciences IRB; National Institutes of Health IRB; Johns Hopkins IRB; Cleveland Clinic IRB. Informed consent was collected from all participants at each centre. Patient clinical objectives were not impacted by the collection of this research data. The dataset consists of iEEG and EEG data from 100 individuals across 5 epilepsy centers in the US that were resective surgery candidates. However, a large portion of the data was simply not available because one of the research centres failed to de-identify and share it. In the OpenNeuro repository online there are 35 data entries. However, for the purposes of our study, 12 entries were not usable due to inconsistencies in the clinical annotations. For example, in some cases there were not marks for the seizure onset or the seizure offset events, which posed a significant limitation given the supervised learning configuration of our GNN models. Thus, we only used 23 subjects from this dataset, which we describe in Table 1. All subjects were monitored with electrocorticography (ECoG) electrodes. All subjects underwent resective surgery, except for UMMC001 and UMMC007. The surgery outcome was set as success or failure, where the former meant that no seizure events were registered on the patient after surgery, and the latter that seizure events continued to occur. The post-surgery monitoring period varied from patient to patient, with the shorter monitoring period being 1 year and the longest 7 years.
Table 1.
Summary of patient information for the 23 subjects from the OpenNeuro ds003029 dataset and the 16 subjects from the SWEC-ETHZ dataset.
| Database | ID | Signal channel # | Seizure # | Seizure duration (s) | Age | Engel score | |||
|---|---|---|---|---|---|---|---|---|---|
| Mean | Std | Min | Max | ||||||
| OpenNeuro | PT1 | 84 | 4 | 107 | 37 | 85 | 163 | 30 | 1 |
| PT2 | 62 | 3 | 279 | 275 | 98 | 596 | 28 | 1 | |
| PT3 | 97 | 2 | 104 | 25 | 86 | 123 | 45 | 1 | |
| PT6 | 80 | 3 | 125 | 32 | 105 | 163 | 33 | 2 | |
| PT7 | 94 | 3 | 52 | 18 | 30 | 63 | 39 | 3 | |
| PT8 | 59 | 3 | 89 | 4 | 85 | 93 | 25 | 1 | |
| PT10 | 55 | 3 | 134 | 26 | 103 | 151 | 44 | 2 | |
| PT12 | 54 | 2 | 372 | 186 | 240 | 503 | 43 | 2 | |
| PT13 | 117 | 4 | 9 | 0.5 | 8 | 9 | 27 | 1 | |
| PT14 | 58 | 2 | 99 | 22 | 83 | 115 | 49 | 4 | |
| PT16 | 46 | 3 | 151 | 83 | 94 | 246 | 52 | 1 | |
| UMMC001 | 87 | 3 | 101 | 9 | 91 | 110 | 23 | NA | |
| UMMC002 | 49 | 3 | 146 | 83 | 50 | 205 | 17 | 1 | |
| UMMC003 | 45 | 3 | 111 | 28 | 92 | 143 | 31 | 1 | |
| UMMC004 | 46 | 3 | 123 | 30 | 101 | 157 | 38 | 1 | |
| UMMC005 | 48 | 2 | 137 | 22 | 121 | 153 | 47 | 1 | |
| UMMC006 | 52 | 3 | 29 | 5 | 22 | 33 | 36 | 1 | |
| UMMC007 | 30 | 3 | 182 | 67 | 105 | 228 | 54 | NA | |
| UMMC009 | 45 | 3 | 70 | 40 | 24 | 100 | 36 | 1 | |
| JH101 | 107 | 4 | 70 | 92 | 22 | 209 | NR | 4 | |
| JH103 | 88 | 3 | 118 | 16 | 99 | 133 | NR | 4 | |
| JH108 | 136 | 4 | 39 | 18 | 10 | 50 | NR | 4 | |
| UMF001 | 76 | 1 | 31 | – | 31 | 31 | 37 | 1 | |
| SWEC-ETHZ | 1 | 47 | 4 | 85 | 57 | 10 | 136 | 24 | 2 |
| 2 | 42 | 4 | 223 | 88 | 96 | 301 | 19 | 1 | |
| 3 | 98 | 2 | 99 | 36 | 73 | 125 | 25 | 1 | |
| 4 | 62 | 4 | 140 | 14 | 127 | 160 | 32 | 4 | |
| 5 | 54 | 4 | 105 | 33 | 84 | 154 | 20 | 2 | |
| 6 | 64 | 4 | 145 | 47 | 89 | 190 | 48 | 1 | |
| 7 | 36 | 2 | 15 | 1 | 14 | 16 | 31 | 4 | |
| 8 | 59 | 2 | 56 | 6 | 52 | 61 | 38 | 4 | |
| 9 | 56 | 4 | 119 | 11 | 104 | 129 | 27 | 1 | |
| 10 | 100 | 4 | 12 | 1 | 10 | 14 | 46 | 2 | |
| 11 | 64 | 2 | 109 | 36 | 83 | 135 | 26 | 1 | |
| 12 | 49 | 4 | 36 | 10 | 23 | 46 | 59 | 4 | |
| 13 | 92 | 4 | 72 | 36 | 19 | 100 | 49 | 2 | |
| 14 | 74 | 4 | 493 | 313 | 154 | 903 | 36 | 1 | |
| 15 | 61 | 3 | 120 | 66 | 52 | 184 | 23 | 4 | |
| 16 | 59 | 4 | 80 | 9 | 67 | 89 | 31 | 2 | |
Definitions of Engel score classifications are as follows: 1—free of disabling seizures; 2—rare disabling seizures; 3—worthwhile improvement; 4—no worthwhile improvement; NA—data not available.
Each patient dataset consists in 1 to 4 runs of seizure activity of varying duration. A run is considered as a single recording of iEEG activity that captures one seizure event, and is characterized by containing three time periods, the preictal, ictal, and postictal periods, which correspond to instances of time before, during, and after the seizure event. Each run that we selected has been clinically annotated for seizure onset and seizure offset times. The monitoring resolution across patients varied from 250 Hz, 500 Hz, and 1 kHz. We have selected 67 runs in total for the 23 patients, with an average number of signal channels of 71.86 ± 26.32, the average number of seizures in the dataset is 2.86 ± 0.66, and the average seizure duration time in seconds is 118.91 ± 78.82.
SWEC-ETHZ short-term dataset
We used another publicly available dataset hosted by the Sleep-Wake-Epilepsy-Center (SWEC) of the University Department of Neurology at the Inselspital Bern and the Integrated Systems Laboratory of the ETH Zurich at http://ieeg-swez.ethz.ch/. This was first used by Burrello et al.18,19, where they investigated the problem of seizure detection using hyperdimensional computing. All participants gave written informed consent that their data may be used for research purposes. The dataset consists in 100 anonymized intracranially recorded electroencephalographic (iEEG) datasets of 16 patients with pharmaco-resistant epilepsy who were evaluated for epilepsy surgery.
iEEG signals were recorded using implanted strip, grid, and depth electrodes, digitized at 16-bit resolution, band-pass filtered (0.5–150 Hz) with a fourth-order Butterworth filter, and sampled at 512 Hz. To reduce phase distortion, filtering was applied bidirectionally. A board-certified epileptologist (K.S.) visually inspected all recordings to identify seizure onset/offset and remove artifact-contaminated channels. Each recording includes 3-minute preictal and postictal periods, along with an ictal segment lasting 10 to 1002 seconds. For consistency with the OpenNeuro dataset, we only kept up to 4 seizure files per patient, though more seizure files are available in a per-patient basis. A summary of the data is shown in Table 1, which was adapted from19 and modified to the number of seizures and seizure duration statistics. We have selected 55 runs in total for the 16 patients, with an average number of signal channels of 61.93 ± 18.77, the average number of seizures in the dataset is 3.37 ± 0.74, and the average seizure duration time in seconds is 116.25 ± 107.27.
Data processing pipeline
The data processing pipeline that we developed is illustrated in Fig. 1. It is entirely developed in Python, and it uses the MNE software32 for iEEG data management and preprocessing, the Spektral project33 and Keras34 with Tensorflow35 for data balancing and GNN model handling, and it leverages the supercomputer infrastructure from the Canada-wide High Performance Computing platform from the Digital Research Alliance of Canada. The technical integration of these tools with our customized software interfaces will be disseminated elsewhere.
Fig. 1.
Entire pipeline from graph representation creation to input to the graph neural network. (A) iEEG signal trace labeled with seizure onset (
) and seizure offset (
), with corresponding ictal classes shown. To create FCNs, we declare a window W (in green, top-left) that indicates the portion of the iEEG record to analyze. Then, we declare a sliding window SW (in blue, top-center) that indicates how to slide W over the entire record. (B) Illustration of 4 FCNs sequentially created by sliding W by SW. (C) The result is a multidimensional array shaped by (
), representing an FCN sequence. (D)
is the original graph represented as a set of vertices V and edges E. (E)
is a graph representation with 3 elements: an adjacency matrix,
, a node features vector,
, and an edge features vector,
, where M and N are the number of node and edge features, respectively. (F) Architecture of the GNN model proposed by Grattarola et. at. in12, extended for multi-class classification.
iEEG data management
Monitoring an epilepsy patient with iEEG for a 24/7 period collects around 10 TB (terabytes) of data. Handling iEEG data is a concern of every hospital or EMU, and it is influenced by the monitoring equipment available to these entities, and the clinical and technical expertise of the individuals working with the data. This unstandardized practice has resulted in large heterogeneous iEEG datasets that are not findable, accessible, interoperable and reusable (FAIR), and that have limited clinical use within their own centers36. Thus, iEEG data management standardization protocols are required. In 2019, the iEEG-BIDS protocol was proposed in37, which extends the Brain Imaging Data Structure (BIDS) protocol38 to operate with iEEG data. Since then, the iEEG-BIDS protocol has been spread around the iEEG research and clinical community, although its adoption as a gold-standard has yet to be realized. The OpenNeuro ds003029 dataset17 is stored under the iEEG-BIDS format. Within our pipeline, we leverage iEEG-BIDS data handling processes with the MNE software39, which provides robust tools to read/write and process this type of data. In contrast, the SWEC-ETHZ dataset is stored in a customized data format leveraging Python NumPy arrays.
Data preprocessing
Although iEEG data can be captured at high sampling rates of up to 25 KHz40, clinical practice often relies on lower recording resolutions from 250 Hz to 2 kHz41. Despite the availability of high resolution sensors, the monitoring process is far from perfect, and recordings are often corrupted due to many-form noise sources. These include power-line electricity noise and artifacts caused by involuntary body movements (i.e., eye-lid or muscle movement). Moreover, it is common to have unusable data from bad channels due to bad electrode placement or contact. Data corruption phenomena are commonly fixed by preprocessing the data, which is yet another unstandardized process in clinical and research practice.
Our iEEG data preprocessing pipeline consists in first removing bad channels from the dataset which were identified by the clinicians, and are part of the metadata found within the iEEG-BIDS format in the OpenNeuro dataset. The SWEC-ETHZ dataset already contains only good channels. Next we apply a notch filter at 60 Hz and corresponding harmonics (120 Hz, 180 Hz, etc.), to attenuate the presence of power-line noise. We do not perform any artifact removal or artifact reconstruction method as we are interested in using the data with as little preprocessing as possible. This part of our pipeline also leverages the MNE software tools for iEEG signal processing.
The electrophysiological activity of the brain is known to use different frequency bands for different purposes. For instance, recently low-gamma oscillations have been found to be involved in emotional regulation, and high-gamma oscillations seem to be involved in speech temporal information42,43. However, the self-regulatory neuromodulation processes of the brain are vastly unknown. Consequently, we are also interested in investigating the role of different frequency bands and their role in seizure events. Moreover, we are interested in devising how to use this information to create powerful iEEG-GRs to improve seizure phase classification with GNNs. For this, our preprocessing pipeline also includes bandpass filtering with a highpass filter set at 0.1 Hz and a lowpass filter set at the Nyquist limit, which depends on the sampling frequency of each run. Last, we clip each preprocessed run in their preictal, ictal, and postictal signal traces, and stored them in serialized file objects.
Functional connectivity networks
FCNs are abstractions of brain data that aim to represent the dynamics of neurophysiological activity recorded with neuroimaging tools, such as diffusion tensor imaging (DTI) or electrophysiological tools, such as iEEG. FCNs are useful to study neurophysiological activity from a networks perspective, and they can be used to map network-modeled neurophysiological activity to behavioral and cognitive dimensions. Network analysis of iEEG data pose new perspectives to uncover neural circuits underlying neurological disorders, which will be instrumental for the development of new treatment options44.
In this study, we focus solely on iEEG-based FCNs. Thus, the purpose of the iEEG data-to-network abstraction is to quantify the degree of similarity across iEEG signals. While there are several methods to create iEEG-based FCNs, mapping FCNs to behavioral or cognitive tasks is an active research field, and there is no one method that is useful for all cases. Even within EEG signal analysis for epilepsy and seizure, there exist numerous different viable FCN methods, such as directed transfer function (DTF), Granger causality, and entropy-based metrics45. For this study, we consider the methods of Pearson correlation, coherence, and phase-lock value (PLV), which have all been used in state of the art EEG connectivity analysis46.
Pearson correlation quantifies the linear relationship between two time series,
and
, in the time domain. It ranges from
(perfect inverse correlation) to
(perfect direct correlation), with
indicating no linear relationship. It is computed as:
![]() |
where
and
are the mean values of
and
, respectively. Its strengths lie in simplicity of computation and interpretability.
Coherence measures the consistency of phase and amplitude relationships between two signals at each frequency. Given the cross-spectrum
and auto-spectra
,
, coherence is defined as:
![]() |
This value lies in the range
and reflects the strength of linear coupling at frequency
. Coherence is frequency-resolved and useful for identifying band-specific connectivity patterns.
The phase-locking value (PLV) measures the consistency of phase differences between two signals over time, independent of amplitude. To compute it, each signal is transformed into its analytic form using the Hilbert transform, which gives access to the instantaneous phase. If
is a real-valued signal, its analytic representation is
, where
is the Hilbert transform of
. The instantaneous phase is then
. Given two signals with phase time series
and
, the PLV is:
![]() |
PLV ranges from
to
, where
indicates perfect phase locking (i.e., a consistent phase difference over time), and
indicates no consistent phase relationship. PLV is especially useful for analyzing neural synchrony, such as during seizures or cognitive tasks, although it does not capture directionality or amplitude information.
Our method for FCN creation is illustrated in Fig. 1 blocks A–C. In block A, we show an iEEG run from one patient, where the y-axis depicts the signals collected at each signal channel (measuring energy in Volts), and the x-axis depicts time starting at t0 and ending at L seconds. For the binary classification problem (nonictal vs. ictal) we label nonictal data (preictal and postictal traces) as class 0, and ictal data as class 1. For the multi-class classification (preictal vs. ictal vs. postictal) problem we label preictal, ictal, and postictal data as class 0, 1, and 2, respectively. There are two markers on each run,
and
, indicating the beginning and the end of the ictal activity as annotated by the clinical experts. To compute FCNs, we define a window, W, depicted in green at the top-left, which indicates the interval of time in which the degree of connectivity across signals is assessed. Then, we define a sliding window, SW, which indicates how to slide W across the run to create FCN sequences as depicted in blocks B and C. For this study, we consider 1 s W and 0.125 s SW. We chose a relatively shorter window length to produce more sampled frames for our graph representation machine learning model.
Graph representations
In computer science, GRs are data structures that extend the original graph data structure to account for node and edge feature vectors. Take for instance a regular graph data structure illustrated in Fig. 1 blocks D–E, D, where
, and V and E are sets of vertices and edges between vertices. Instead, the GR in E is represented as
, where A is an adjacency matrix or “original graph”,
and
are sets of multidimensional vectors representing node and edge features47. In our work, each node corresponds to an iEEG signal channel. In alignment with our aim to construct a generalizable and non-specific pipeline, we include all signal channels. FCNs can be incorporated into the adjacency matrix and/or the edge features vector. Similar to the creation of sequences of FCNs in Fig. 1 panel C, we can create sequences of GRs to increment the representational power of the abstracted data.
Graph-structured data contained within GRs are commonly used as input data to build GNN models, a paradigm of artificial neural networks optimized to operate with graph-structured data. In recent years, GNN models have been used to advance the understanding of real-life network phenomena found across several scientific fields including physics and chemistry47. More recently, some works have started to show the potential of GNNs to assist the field of neuroscience12,48, but further research is require to deploy these models in the clinical practice. Importantly, the ability of GNN models to learn about the graphs they operate on is dependant on the abstraction of the data within the GRs, which is still considered an art in the realm of deep learning and AI. In this study, we investigate the creation of GRs of iEEG data that are more helpful to build a GNN model for seizure phase classification.
Our goal is to understand what combination of graph representation elements renders the most powerful iEEG-GR for seizure phase classification. We first consider 9 GRs, presented in Table 2, which we cluster in 2 groups. The first group is composed of baseline tests PC-1-1, COH-1-1, and PLV-1-1 that correspond to the baseline GRs used in12 (PC-1-1 and COH-1-1), where node and edge features are considered as all-ones vectors, and adjacency matrices are considered as FCNs of the Pearson correlation and PLV methods. Test COH-1-1 was not used in12, but we include it to evaluate the usage of the coherence method in this form. The second group is composed of tests PC-E-COH, PC-E-PLV, COH-E-PC, COH-E-PLV, PLV-E-PC, and PLV-E-COH and correspond to GRs that use the average energy recorded by the iEEG electrode signal channels as node features vector and FCNs of the Pearson correlation, coherence, and PLV methods. Note that we use different FCNs for the adjacency matrix and the edge features in order to maximize the amount and diversity of information present in our graph representations. In theory, greater information should increase representational and predictive capacity. However, we acknowledge that irrelevant information may add noise and hinder model performance. Based on previous successes with each of these three FCN measures in EEG data processing46, we suggest it is unlikely that extra information from these FCN measures would be irrelevant. Moreover, the functionality of our graph neural network model is to automatically attend to more relevant input features (especially the graph attention layer, which will be described later), attenuating less relevant information.
Table 2.
Graph representation elements.
| Test | AM | Node Features | Edge Features |
|---|---|---|---|
| PC-1-1 | PC | 1 | 1 |
| COH-1-1 | COH | 1 | 1 |
| PLV-1-1 | PLV | 1 | 1 |
| PC-E-COH | PC | ![]() |
COH |
| PC-E-PLV | PC | ![]() |
PLV |
| COH-E-PC | COH | ![]() |
PC |
| COH-E-PLV | COH | ![]() |
PLV |
| PLV-E-PC | PLV | ![]() |
PC |
| PLV-E-COH | PLV | ![]() |
COH |
AM: Adjacency matrix metric, GNN: Graph neural network layers, PC: Pearson correlation, PLV: phase-lock value, Coh: coherence, (
) 1: all-ones vector,
: average energy at channel (e)
We compute normalized average energy (which in this paper is also simply referred to as “average energy”) for each signal channel by summing the squared amplitudes over time and applying
normalization. Given the EEG signal
, where V is the number of signal channels and T the number of time points, the energy vector
is defined as:
![]() |
The resulting normalized average energy vector
represents the relative energy across signal channels.
We next consider expansions of the node and edge feature dimensionality. For node features, we can consider overall average energy alongside average energy by frequency band. The average energy at signal channel by frequency band has a shape of (V, F), where F corresponds to the frequency bands considered. For iEEG signals that were recorded with a 250 Hz sampling rate,
, as we consider the frequency bands
, delta (1–4 Hz),
, theta (4–8 Hz),
(8–13 Hz), alpha
, (13–30 Hz),
, gamma (30–70 Hz), and
, high-gamma (70–100 Hz). For signals that were recorded with a 500 Hz sampling rate,
, as we also consider ripples in the frequency band (100–250 Hz). For signals recorded at 1 kHz sampling rate,
, as we also consider fast ripples in the frequency band (250–500 Hz). We then create the node features vectors for these tests by concatenating the vectors for the average energy at signal channel and the average energy at signal channel by frequency band. Similarly, for edge features, we can expand from overall coherence to average coherence by frequency band.
Data balancing
To evaluate the GNN model, we split each patient dataset in train, validation, and test sets, taken from 80%, 10%, 10% of the data, respectively. However, the amount of data samples varies from the preictal, ictal, and postictal signal traces, meaning that there is an imbalanced class representation for the binary and multi-class classification problems. Consequently, we implement a data balancing algorithm that guarantees there is a balanced representation of classes. For this, we consider the maximum number of ictal samples within a run to be the total number of ictal samples, and non-ictal samples are taken from the preictal and postictal traces in equal amounts. Each data sample represents a GR that is used for the train, validation, and test datasets, marked with a red cross, a cyan square, and a turquoise circle, respectively.
Graph neural network architecture
ECC, edge-conditioned convolutional layer
The GNN model proposed by Grattarola et al. in12, depicted in Fig. 1 panel F, serves as the basis for all graph representation experiments in this work, except those specifically evaluating different GNN layers described below. This architecture consists of a 2-layer neural network with an edge-conditioned convolution (ECC) layer49, followed by a graph attention network (GAT) layer50.
The ECC layer focuses on learning transformations that depend on edge attributes, enabling it to model interactions between nodes based not only on their features but also on the characteristics of the edges connecting them. The GAT layer, in turn, applies an attention mechanism to assign importance scores to neighboring nodes, dynamically weighting their influence during feature aggregation.
In12, the authors used attention coefficients to localize the seizure onset zone (SOZ), although we did not find this method successful in our setting. We aim to develop improved strategies for SOZ localization in future work.
The ECC layer computes:
![]() |
1 |
Here:
Y(i) is the output feature vector at node i.
denotes the set of neighboring nodes of node i.X(j) is the input feature vector at node j.
L(j, i) is the edge feature between nodes j and i.
F(L(j, i); w) is a neural network (typically a small MLP) parameterized by weights w, which computes a filter
conditioned on the edge features.
This formulation enables edge-aware feature propagation, making ECC particularly useful in settings where edge features (e.g., functional connectivity between EEG channels) carry critical information.
GCN, graph convolutional layer
The graph convolutional network (GCN) layer performs a neighborhood aggregation where each node updates its features based on a weighted average of its neighbors, including itself. The equation is:
![]() |
where:
X is the input feature matrix.
is the output feature matrix.
is the adjacency matrix with added self-loops.
is the diagonal degree matrix of
.W and b are learnable weight and bias parameters.
The normalization with
ensures numerical stability and balances the influence of nodes with varying degrees.
Diff, diffusion convolutional layer
The diffusion convolutional layer captures information from multi-hop neighborhoods via repeated applications of the adjacency matrix. For each output channel q, the transformation is given by:
![]() |
where:
is the input feature vector of channel f.
is a row-normalized adjacency matrix.K is the number of diffusion steps.
are learnable parameters for each step k.
is a non-linear activation function (e.g., ReLU).
This formulation allows the model to aggregate information from increasingly distant neighbors, akin to simulating a diffusion process over the graph.
Cheb, Chebyshev convolutional layer
The Chebyshev convolutional layer uses spectral filtering via Chebyshev polynomials to perform localized graph convolutions. It is defined as:
![]() |
where:
is the k-th Chebyshev polynomial of the scaled Laplacian
.
,
are learnable weight and bias parameters for each order k.- The Chebyshev polynomials are recursively defined as:

is the scaled graph Laplacian.
This approach allows efficient and stable spectral filtering without computing the full eigenbasis of the Laplacian.
GAT, graph attention layer
The graph attention network (GAT) layer50 introduces attention coefficients to assign varying importance to neighboring nodes during aggregation. Each node learns to focus more on relevant neighbors based on a learned attention mechanism.
The output is computed as:
![]() |
where:
![]() |
Here:
denotes vector concatenation.
is a learnable attention vector.W is a learnable weight matrix.
Dropout may be applied to
before the final aggregation.
Multiple attention heads can be computed in parallel, with their outputs either concatenated or averaged. This mechanism enables the network to adaptively select the most informative neighbors for each node.
Pooling layer
Pooling in GNNs reduces the graph size by aggregating node-level information. In the ECC context, the pooling operation is guided by learned functions of the edge features:
![]() |
where F is a learnable function (e.g., a neural network) that maps edge features L(j, i) to weights
This process determines the relative influence of neighboring nodes in the aggregated representation. By incorporating both node and edge information, pooling helps the network capture higher-order interactions and global graph properties.
Code availability
The entire graph representation and graph neural network pipeline has been containerized into a Python package, available at https://github.com/Richqrd/bgreg-main-public. To use the repository, sample scripts are located in the ‘projects’ directory and the Python modules are located under ‘bgreg’. Input data can be inserted under ‘data_files’, enabling dataset customization.
Results
Graph representations
Leveraging node and edge features
Table 3 shows the results of binary seizure phase classification. Note that all tests with non-trivial node and edge features in the second group outperform the first group (baseline) tests with all-ones vector node and edge features (PC-1-1, COH-1-1, PLV-1-1).
Table 3.
Mean (SD) performance evaluation of GNN model for binary classification across 23 subjects.
| Metric | PC-1-1 | COH-1-1 | PLV-1-1 | PC-E-COH | PC-E-PLV | COH-E-PC | COH-E-PLV | PLV-E-PC | PLV-E-COH |
|---|---|---|---|---|---|---|---|---|---|
| Loss |
0.5992 (0.0688) |
0.5648 (0.1147) |
0.6354 (0.0642) |
0.3261 (0.1298) |
0.3980 (0.1347) |
0.3435 (0.1256) |
0.4471 (0.1176) |
0.3941 (0.1320) |
0.4611 (0.1263) |
| Accuracy |
0.6717 (0.0819) |
0.6881 (0.1075) |
0.6426 (0.0994) |
0.8716 (0.0711) |
0.8253 (0.0847) |
0.8602 (0.0711) |
0.7982 (0.0802) |
0.8317 (0.0767) |
0.7936 (0.0785) |
| AUC |
0.7284 (0.0838) |
0.7481 (0.1154) |
0.6679 (0.1186) |
0.9352 (0.0559) |
0.8945 (0.0732) |
0.9240 (0.0606) |
0.8715 (0.0772) |
0.8975 (0.0698) |
0.8636 (0.0750) |
| F1-Score |
0.6607 (0.1619) |
0.6821 (0.1392) |
0.6861 (0.1084) |
0.8685 (0.0817) |
0.8225 (0.0946) |
0.8528 (0.0865) |
0.7898 (0.1006) |
0.8275 (0.0870) |
0.7857 (0.0927) |
The top performing metrics are shown in bold, while the lowest performing ones are shown in italics.
In Table 4 we show the evaluation of the GNN model using the same GRs from the binary classification problem for the multi-class classification problem. The baseline tests are excluded as their relatively lower performance had already been indicated through the binary problem. Here, we also see that by including more data within the GRs we can significantly improve the performance of the GNN model in accuracy, AUC, and F1-score with mean performance across the 23 subjects of 85%, 84%, and 80% for tests PC-E-COH, COH-E-PC, and PLV-E-PC. Importantly, we can see that the GNN model is capable of discriminating between preictal and postictal signal traces, showing a potential to develop seizure prediction algorithms in the future.
Table 4.
Mean (SD) performance evaluation of GNN model for multi-class classification across 23 subjects.
| Metric | PC-E-COH | PC-E-PLV | COH-E-PC | COH-E-PLV | PLV-E-PC | PLV-E-COH |
|---|---|---|---|---|---|---|
| Loss |
0.4050 (0.1881) |
0.5047 (0.2078) |
0.4254 (0.1882) |
0.5809 (0.1973) |
0.5073 (0.2042) |
0.5885 (0.1844) |
| Accuracy |
0.8504 (0.0892) |
0.7961 (0.1101) |
0.8369 (0.0933) |
0.7649 (0.1055) |
0.7975 (0.1047) |
0.7615 (0.0991) |
| AUC |
0.9545 (0.0440) |
0.9240 (0.0643) |
0.9479 (0.0467) |
0.9082 (0.0655) |
0.9241 (0.0640) |
0.9065 (0.0639) |
| F1-Score |
0.8241 (0.1051) |
0.7597 (0.1295) |
0.8105 (0.1059) |
0.7260 (0.1211) |
0.7633 (0.1254) |
0.7195 (0.1186) |
The top performing metrics are shown in bold, while the lowest performing ones are shown in italics.
In general, our methodology is better than the baseline, however, the same GR structures do not work equally well for all patients, as evident in certain outliers and standard deviations in the presented tables. We speculate that similar to the difficulties encountered by clinical experts in visually inspecting the iEEG data, GNN models struggle to learn features from ambiguous or corrupted data recordings.
Different adjacency matrix window lengths
We aim to establish an optimal time span for the window used in the computation of the adjacency matrix metric. Given its superior performance as illustrated in the previous section, we use coherence as the adjacency metric in our tests. In Fig. 2, we show that increases in adjacency matrix window time span from 1 to 20 seconds trends toward greater performance in test accuracy, F1-Score, and AUC. Moreover, the 20s time span shows statistically significantly better performance in all aforementioned metrics among the patient dataset compared to all the time spans 5s and shorter. (
from Man-Whitney U test). There are no sacrifices in training time, as represented in Fig. 2d . Note that attempting to compute adjacency matrices for time spans beyond 20 s resulted in computation problems, such as memory overflow issues, largely due to artefacts and errors present in the original dataset. Thus, for our purposes we conclude that 20s is the optimal time span for computation of the adjacency matrix in GRs in order to maximize performance.
Fig. 2.
Test performance and training time for binary seizure phase classification from graph representations with varying window times for their adjacency matrix computation. Coherence is used as the adjacency matrix metric. A Man-Whitney U test is run (* indicates
, ** indicates
.
Extending node and edge features
We first explore the effects of increasing the information stored in GR node features by expanding their dimensions. Node features are expanded to include both average overall energy as well as average energy by frequency band, potentially yielding up to 9 total dimensions depending on the original data.
We use phase locking value as edge features and 20s windows of coherence as the adjacency matrix metric. Using the multi-task classification problem, we obtain mean loss (SD) 0.1741 (0.1126), mean accuracy (SD) 95.26% (3.57%), mean AUC (SD) 0.9906 (0.0115), and mean F1-Score (SD) 0.9411 (0.0441). This demonstrates improvement over all tests from Table 4.
Next we explore expanding edge features. We use the same setup as above (including the expanded node features), except now edge features are expanded to include both average overall coherence as well as average coherence by frequency band. Again, we see a noticeable improvement in all performance metrics: mean loss (SD) 0.1504 (0.2548), mean accuracy (SD) 97.07% (2.62%), mean AUC (SD) 0.9942 (0.0065), and mean F1-Score (SD) 0.9616 (0.0335).
GNN models
We will now vary the first layer of our GNN model, while keeping the second layer constant as a graph attention layer (GAT). Based on previously tested strong performance, all graph representations in this section will employ (1) coherence as the adjacency matrix metric; (2) extended node features comprised of mean energy and energy by frequency band; and (3) extended edge features comprised of mean coherence and coherence by frequency band. To demonstrate robustness of our GR methodology and the GNN models, we conduct tests on 2 separate open-source datasets: OpenNeuro, which was used in all previous testing, and SWEC-ETHZ (Table 5). Both datasets yield similar results, reflecting the stability of our GR pipeline. For both datasets, the edge conditioned convolutional (ECC) layer performed strongest while the diffusion convolution layer was weakest.
Table 5.
Mean (SD) performance evaluation of different GNN Layers for multi-class classification across OpenNeuro and ETHZ datasets.
| Dataset | Metric | ChebGAT | DiffGAT | ECCGAT | GCNGAT |
|---|---|---|---|---|---|
| OpenNeuro | Loss | 0.3377 (0.1486) | 0.5286 (0.3162) | 0.1554 (0.3205) | 0.2383 (0.1158) |
| Accuracy | 0.9023 (0.0618) | 0.7788 (0.1528) | 0.9703 (0.0273) | 0.9353 (0.0417) | |
| AUC | 0.9757 (0.0233) | 0.8996 (0.1171) | 0.9943 (0.0069) | 0.9868 (0.0116) | |
| F1-Score | 0.8831 (0.0752) | 0.6865 (0.2401) | 0.9611 (0.0353) | 0.9200 (0.0503) | |
| ETHZ | Loss | 0.3115 (0.1749) | 0.7174 (0.2987) | 0.1327 (0.1564) | 0.2097 (0.1412) |
| Accuracy | 0.9135 (0.0873) | 0.6858 (0.1529) | 0.9621 (0.0674) | 0.9452 (0.0619) | |
| AUC | 0.9756 (0.0433) | 0.8346 (0.1259) | 0.9897 (0.0268) | 0.9876 (0.0237) | |
| F1-Score | 0.8945 (0.1120) | 0.5630 (0.2567) | 0.9517 (0.0851) | 0.9333 (0.0760) |
The top performing metrics are shown in bold, while the lowest performing ones are shown in italics.
Qualitative embedding analysis
t-SNE was conducted on embeddings generated by the GNN model experiments associated with Table 5 in order to elucidate the transformations underlying each GNN architecture. The worst performing architecture, the diffusion convolutional layer, and the best performing architecture, the edge-conditioned convolutional layer, were chosen among the models for embedding analysis to examine how transformations within the embedding space relate to model performance. The results from a representative subject, ummc001, are shown in Fig. 3.
Fig. 3.
t-SNE was run on embeddings produced by the (a) diffusion and (b) edge-conditioned GNN architectures for 100 graph representations from subject ummc001. Dimensionally reduced embeddings produced by each labeled layer are shown. Scatter points in the figures corresponding to the first 2 layers (e.g., ECC, GAT) represent node embeddings, while the points for the Flatten and Fully Connected (FCN) layers represent whole graph embeddings. Points are coloured with ground truth labels. Subfigure (c) showcases the same node embeddings produced by the ECC layer, but with black circles highlighting nodes corresponding to electrodes within the clinically annotated SOZ.
The strongest indication of performance was the ability of the GNN architecture to aggregate and segregate embeddings based on their label (i.e., nonictal, preictal, ictal) as they progressed through different layers. For instance, the ECC layer, which demonstrated the best performance from Table 5, began forming distinct nonictal, preictal, and ictal clusters as early as the GAT layer, which became increasingly distinct as the data progressed through the flatten and fully connected layers (Fig. 3b ). On the other hand, the poorest performing layer, the diffusion convolution, struggles to separate its embedding points even by the last FCN layer, with unclear clustering and significant overlap of distinct labels (Fig. 3a). This difference in clustering capability validates the previously tested quantitative performance of each of the GNN architectures.
Discussion
Multichannel time-series data modalities including iEEG can be complex and tedious to manually process. Here we present an automated pipeline to process this data by constructing flexible and generalizable graph representations that can be transformed by graph neural networks. Through robust experimentation, we identified optimal graph representation data structures and corresponding high performing neural network models. Our tool shows significant promise in providing ways to qualitatively assess the complex transformations in the embedding space of ML algorithms and in generalizing to a multitude of datasets.
Coupling graph representations with embedding analysis elucidates promising understandings about GNN models. For instance, our results suggest that early layer transformations can be complex but can have substantial downstream effects. Qualitatively, it is challenging to discern substantial clustering or other visual trends in the initial convolutional layer for both the diffusion (Fig. 3a) and ECC (Fig. 3b) architectures. However, despite the initial layer being the only GNN component that was varied, there are significant differences in embedding aggregation across the GAT, flatten, and FCN layers between the architectures, with the ECC architecture demonstrating much stronger clustering. Thus, individual GNN layers can have strong downstream effects in models. It has been suggested that node embedding aggregation and transformation are two major ways in which convolutional GNN layers may affect deeper layers51.
Embedding visual analysis may also assist in the interpretability of GNN errors. As seen in the FCN layer of the ECC architecture (Fig. 3b), several data points are associated with clusters that their label does not belong to (e.g., there exist a few orange ictal embedding points within a larger blue nonictal cluster). Many of these seemingly erroneously clustered data points are located near the borders of distinct clusters in the embedding space. The location of these embeddings may suggest model predictive uncertainty and/or highlight potential discrepancies in clinically annotated labels. For instance, discerning the exact location of the time point of transition between preictal and ictal zones may be uncertain for both models and clinicians. Although the quantitative performance metrics of the ECC model weren’t perfect (Table 5), the locations of these embedding points suggest that model mistakes may in part be as a result of discrepancies in clinical labelling rather than ineffective GNN data transformations. Attempting to address the blackbox of ML methods, similar frameworks have been developed to visualize and/or dimensionally reduce embeddings from both GNNs and other models in order to understand data transformations, outliers, and errors52,53. However, our pipeline uniquely provides flexibility in modifying the underlying graph representation node, edge, and adjacency features behind each embedding, allowing for comprehensive experimentation and customizability.
Furthermore, SOZ transformation within the embedding space appears non-random. Despite the model being trained solely on multi-class seizure phase classification with no explicit information regarding the SOZ, the initial ECC neural network layer appears to project electrodes from the clinically annotated SOZ to specific locations within the embedding space, as seen in the regions with darker black borders in Fig. 3c. Though it is difficult to conclude whether there is segregation from other non-SOZ nodes, there are clear densities of aggregation of nodes associated with the SOZ. This not only supports many previous works which employed GNNs for the problem of SOZ localization12,26, but this also suggests promise for our particular graph representation guided approach in understanding the SOZ.
The graph representation data structures used in our pipeline enable high generalizability to other problems. For instance, once computed, graph representations can be stored for convenient future processing. Our current analysis focused on training GNNs on the graph representations from individual patients. However, because the common graph representation data structure is used, future work could easily compile graph representations from different patients to train cross-subject models. Likewise, it would also be straightforward to combine the graph representations from multiple datasets, such as OpenNeuro and SWEC-ETHZ, together. Although the creation and training of models catered to individual patients is valuable for the development of personalized healthcare technologies, the development of generalizable models can be useful when individual patient data is scarce. Our pipeline can readily extend to multi-patient and/or multi-dataset ML models in future work.
There is also flexibility in the features of our graph representations. Although our work focused on an analysis of FCN metrics including Pearson correlation, coherence, and PLV, other metrics are easily substitutable. Recently, advanced FCN metrics that capture nonlinear relationships such as mutual information and nonlinear Granger causality have been showing promise in neuroscience54. Some studies suggest that directional FCN metrics also provide richer representations of neural signal data54. Transfer entropy is an example of a FCN metric that captures directed, nonlinear relationships, assessing how joint signal information can reduce future signal uncertainty54,55. Aiming to demonstrate the generalizability of the graph representation data structure and to assess the value of directional, nonlinear FCN metrics for the seizure phase classification problem, we conducted exploratory experiments using transfer entropy that we describe here. Our experiments examined transfer entropy as a metric for our graph representation adjacency matrices. For the adjacency matrix, we used 20 second windows and discretized our signals using a conservative estimate of 100 bins based on Scott’s approach56. We used a signal history parameter of k=1 for the transfer entropy calculation, which has been used in other works for computational simplicity57. For node and edge features, we used the best performing metrics from our existing experiments: energy and energy by frequency band were used for node features; and coherence and coherence by frequency band were used for edge features. In line with our other experiments, these graph representations were input into a graph neural network comprised of an edge-conditioned convolutional layer and a graph attention layer for a multi-class seizure phase classification problem. The following results were obtained for transfer entropy: mean loss (SD) 0.1933 (0.2273), mean accuracy (SD) 95.08% (6.34%), mean AUC (SD) 0.9864 (0.0222), mean F1-Score (SD) 0.8723 (0.1859). The results are on par but not superior to our best graph representation that employed coherence as the adjacency matrix metric (Table 5). This is not surprising in consideration that we are already plateauing at state of the art performance with accuracies in the high 90% with our existing graph representations. Different features and FCN metrics, even if truly more reliable and valid, are unlikely to lead to substantial increases in performance. For seizure phase classification, it may be more valuable to utilize simple and reliable linear FCN metrics with efficient computational complexity. However, that is not to say that transfer entropy is not valuable. Its benefit as a FCN metric may be limited in the field of seizure phase classification, but it may be very valuable in other problems that have more subtle and complex nonlinear relationships between signal channels, such as perhaps SOZ localization. Ultimately, we demonstrate that our graph representation data pipeline is highly flexible, able to incorporate complex FCN metrics including transfer entropy, though there may not be much significant benefit for the seizure phase classification problem in particular.
Moreoever, our pipeline is generalizable to multichannel time-series data processing procedures beyond iEEG monitoring of epilepsy. Many neural monitoring tools, including standard electroencephalography (EEG), functional magnetic resonance imaging (fMRI), and magnetoencephalography (MEG), produce data able to be converted to networks or graphs58–61. Our pipeline can seamlessly process these data into graph representations for GNN transformation. Able to handle a plethora of data modalities, our pipeline can address numerous neurological disorders beyond epilepsy such as major depressive disorder, Parkinson’s disease, and Alzheimer’s disease among many others. We provide a method for flexible and systematic automated data processing that can be integrated into diverse clinical workflows.
Conclusion
Automating the process of iEEG-based seizure phase classification within clinical pipelines treating epilepsy is a timely need to improve healthcare practice. In this paper we proposed a multi-channel time series data processing pipeline and applied it to iEEG data to detect preictal, ictal, and nonictal data. Moreover, we demonstrate that by leveraging iEEG signal data as GRs of iEEG data we can significantly improve the performance of GNN-based systems. Though we have demonstrated strong performance for epileptic iEEG data, we aim for future work to extend our generalizable pipeline to other time series data modalities.
Acknowledgements
We thank the epilepsy monitoring unit at the Toronto Western Hospital in Toronto, Canada for sharing their experience in dealing with epilepsy patients and in explaining the challenges in bridging data scientists to epilepsy care. We also thank Professors Taufik Valiante and Mary Pat McAndrews at the Krembil Research Institute for their valuable input and support in the conceptualization of this project. As well, we thank Dr. Daniele Grattarola for sharing his technical expertise in the development of graph neural network models.
Author contributions
M.L. and A.A.D.M. were involved in study conceptualization; A.A.D.M. and R.Z. designed and conducted the methodology, data analysis, and results visualization; M.L. verified the study concept; A.A.D.M. and R.Z. drafted the original manuscript; A.A.D.M., R.Z., and M.L. were involved in manuscript review and editing; M.L. provided funding support and project supervision.
Data availability
All data produced are available online at: (1) The OpenNeuro Epilepsy-iEEG-Multicenter-Dataset with accession number ds003029, accessible through https://openneuro.org/datasets/ds003029/versions/1.0.7; (2) The SWEC-ETHZ iEEG Database, accessible through http://ieeg-swez.ethz.ch/.
Declarations
Competing interests
The authors declare no competing interests.
Footnotes
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Alan A. Díaz-Montiel and Richard Zhang contributed equally to this work.
References
- 1.Reynolds, E. H. The ILAE/IBE/WHO epilepsy global campaign history. Epilepsia43, 9–11 (2002). [DOI] [PubMed] [Google Scholar]
- 2.Kovac, S., Vakharia, V. N., Scott, C. & Diehl, B. Invasive epilepsy surgery evaluation. Seizure44, 125–136 (2017). [DOI] [PubMed] [Google Scholar]
- 3.Mansouri, A., Fallah, A. & Valiante, T. A. Determining surgical candidacy in temporal lobe epilepsy. Epilepsy Res. Treat.2012, 706917 (2012). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 4.Covert, I. C. et al. Temporal graph convolutional networks for automatic seizure detection. In Machine Learning for Healthcare Conference, 160–180 (PMLR, 2019).
- 5.Pinto, M. F. et al. The goal of explaining black boxes in EEG seizure prediction is not to explain models’ decisions. Epilepsia Open8, 285–297 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 6.Batista, J. et al. EEG epilepsy seizure prediction: The post-processing stage as a chronology. Sci. Rep.14, 407 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 7.Hassan, K. M., Islam, M. R., Tanaka, T. & Molla, M. K. I. Epileptic seizure detection from eeg signals using multiband features with feedforward neural network. In 2019 International conference on cyberworlds (CW), 231–238 (IEEE, 2019).
- 8.Zhao, Y. et al. EEG-Based Seizure detection using linear graph convolution network with focal loss. Comput. Methods Progr. Biomed.208, 106277 (2021). [DOI] [PubMed] [Google Scholar]
- 9.Li, Z., Hwang, K., Li, K., Wu, J. & Ji, T. Graph-generative neural network for EEG-based epileptic seizure detection via discovery of dynamic brain functional connectivity. Sci. Rep.12, 18998 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 10.Wang, J. et al. EEG signal epilepsy detection with a weighted neighbour graph representation and two-stream graph-based framework. IEEE Trans. Neural Syst. Rehabil. Eng.31, 3176–3187 (2023). [DOI] [PubMed] [Google Scholar]
- 11.Wang, Y. et al. A spatiotemporal graph attention network based on synchronization for epileptic seizure prediction. IEEE J. Biomed. Health Inform.27, 900–911 (2022). [DOI] [PubMed] [Google Scholar]
- 12.Grattarola, D., Livi, L., Alippi, C., Wennberg, R. & Valiante, T. A. Seizure localisation with attention-based graph neural networks. Expert Syst. Appl.203, 117330 (2022). [Google Scholar]
- 13.Jia, M. et al. Efficient graph convolutional networks for seizure prediction using scalp EEG. Front. Neurosci.16, 967116. 10.3389/fnins.2022.967116 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 14.Zeng, D., Huang, K., Xu, C., Shen, H. & Chen, Z. Hierarchy graph convolution network and tree classification for epileptic detection on electroencephalography signals. IEEE Trans. Cogn. Dev. Syst.13, 955–968 (2021). [Google Scholar]
- 15.Lian, Q., Qi, Y., Pan, G. & Wang, Y. Learning graph in graph convolutional neural networks for robust seizure prediction. J. Neural Eng.17, 035004. 10.1088/1741-2552/ab909d (2020). [DOI] [PubMed] [Google Scholar]
- 16.Statsenko, Y. et al. Automatic detection and classification of epileptic seizures from EEG data: Finding optimal acquisition settings and testing interpretable machine learning approach. Biomedicines11, 2370 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 17.Li, A. et al. Epilepsy-iEEG-Multicenter-Dataset (2021).
- 18.Burrello, A., Schindler, K., Benini, L. & Rahimi, A. One-shot learning for iEEG seizure detection using end-to-end binary operations: Local binary patterns with hyperdimensional computing. In 2018 IEEE Biomedical Circuits and Systems Conference (BioCAS), 1–4 (IEEE, 2018).
- 19.Burrello, A., Schindler, K., Benini, L. & Rahimi, A. Hyperdimensional computing with local binary patterns: One-shot learning of seizure onset and identification of ictogenic brain regions using short-time ieeg recordings. IEEE Trans. Biomed. Eng.67, 601–613 (2019). [DOI] [PubMed] [Google Scholar]
- 20.Li, Z. et al. Deep learning of simultaneous intracranial and scalp EEG for prediction, detection, and lateralization of mesial temporal lobe seizures. Front. Neurol.12, 705119 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 21.Tang, L., Xie, N., Zhao, M. & Wu, X. Seizure prediction using multi-view features and improved convolutional gated recurrent network. IEEE Access8, 172352–172361 (2020). [Google Scholar]
- 22.Nejedly, P. et al. Exploiting graphoelements and convolutional neural networks with long short term memory for classification of the human electroencephalogram. Sci. Rep.9, 11383 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 23.Wang, G. et al. Seizure prediction using directed transfer function and convolution neural network on intracranial eeg. IEEE Trans. Neural Syst. Rehabil. Eng.28, 2711–2720 (2020). [DOI] [PubMed] [Google Scholar]
- 24.Wang, Y. et al. SEEG-NET: An explainable and deep learning-based cross-subject pathological activity detection method for drug-resistant epilepsy. Comput. Biol. Med.148, 105703 (2022). [DOI] [PubMed] [Google Scholar]
- 25.Dissanayake, T., Fernando, T., Denman, S., Sridharan, S. & Fookes, C. Geometric deep learning for subject independent epileptic seizure prediction using scalp EEG signals. IEEE J. Biomed. Health Inform.26, 527–538 (2021). [DOI] [PubMed] [Google Scholar]
- 26.Liu, X., Hu, L., Wang, S. & Shen, J. Localization of seizure onset zone with epilepsy propagation networks based on graph convolutional network. Biomed. Signal Process. Control74, 103489 (2022). [Google Scholar]
- 27.Bartolomei, F., Chauvel, P. & Wendling, F. Epileptogenicity of brain structures in human temporal lobe epilepsy: A quantified study from intracerebral EEG. Brain131, 1818–1830 (2008). [DOI] [PubMed] [Google Scholar]
- 28.Balatskaya, A. et al. The “connectivity epileptogenicity indexâ€(cei), a method for mapping the different seizure onset patterns in stereoelectroencephalography recorded seizures. Clin. Neurophysiol.131, 1947–1955 (2020). [DOI] [PubMed] [Google Scholar]
- 29.Rahmani, A., Venkitaraman, A. & Frossard, P. A meta-GNN approach to personalized seizure detection and classification. In ICASSP 2023–2023 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), 1–5 (IEEE, 2023).
- 30.Raeisi, K. et al. A class-imbalance aware and explainable spatio-temporal graph attention network for neonatal seizure detection. Int. J. Neural Syst.33, 2350046 (2023). [DOI] [PubMed] [Google Scholar]
- 31.Li, A. et al. Neural fragility as an EEG marker of the seizure onset zone. Nat. Neurosci.24, 1465–1474 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 32.Gramfort, A. et al. MEG and EEG data analysis with MNE-Python. Front. Neurosci.7, 1–13 (2013). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 33.Grattarola, D. & Alippi, C. Graph neural networks in tensorflow and keras with spektral [application notes]. IEEE Comput. Intell. Mag.16, 99–106 (2021). [Google Scholar]
- 34.Chollet, F. et al. Keras. https://keras.io (2015).
- 35.Abadi, M. et al. TensorFlow: Large-scale machine learning on heterogeneous systems (2015). https://www.tensorflow.org/. Software available from tensorflow.org.
- 36.Paulk, A. C., Salami, P., Zelmann, R. & Cash, S. S. Electrode development for epilepsy diagnosis and treatment. Neurosurg. Clin.35, 135–149 (2024). [DOI] [PubMed] [Google Scholar]
- 37.Holdgraf, C. et al. iEEG-BIDS, extending the brain imaging data structure specification to human intracranial electrophysiology. Sci. Data6, 102 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 38.Gorgolewski, K. J. et al. The brain imaging data structure, a format for organizing and describing outputs of neuroimaging experiments. Sci. Data3, 1–9 (2016). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 39.Gramfort, A. et al. MNE software for processing MEG and EEG data. Neuroimage86, 446–460 (2014). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 40.You, C. et al. An iEEG recording and adjustable shunt-current conduction platform for epilepsy treatment. Biosensors12, 247 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 41.Yamada, L., Oskotsky, T. & Nuyujukian, P. An acquisition infrastructure for high-resolution intracranial electroencephalography (P7-8.003). Neurology98, 1775 (2022). [Google Scholar]
- 42.Ng, H.-Y.H. et al. Enhanced electroencephalography effective connectivity in frontal low-gamma band correlates of emotional regulation after mindfulness training. J. Neurosci. Res.101, 901–915 (2023). [DOI] [PubMed] [Google Scholar]
- 43.Tamura, S. & Hirano, Y. Cortical representation of speech temporal information through high gamma-band activity and its temporal modulation. Cerebral Cortex bhad158 (2023). [DOI] [PMC free article] [PubMed]
- 44.Ramos, C. G. L. et al. Stereotactic electroencephalography in epilepsy patients for mapping of neural circuits related to emotional and psychiatric behaviors: a systematic review. Neurosurg. Focus54, E4 (2023). [DOI] [PubMed] [Google Scholar]
- 45.Peng, G., Nourani, M. & Harvey, J. SEEG-based bilateral seizure network analysis for neurostimulation treatment. IEEE Trans. Neural Syst. Rehabil. Eng.33, 664–674 (2025). [DOI] [PubMed] [Google Scholar]
- 46.Chiarion, G., Sparacino, L., Antonacci, Y., Faes, L. & Mesin, L. Connectivity analysis in EEG data: A tutorial review of the state of the art and emerging trends. Bioengineering10, 372 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 47.Zhou, J. et al. Graph neural networks: A review of methods and applications. AI open1, 57–81 (2020). [Google Scholar]
- 48.Bessadok, A., Mahjoub, M. A. & Rekik, I. Graph neural networks in network neuroscience. IEEE Trans. Pattern Anal. Mach. Intell.45, 5833–5848 (2023). [DOI] [PubMed] [Google Scholar]
- 49.Simonovsky, M. & Komodakis, N. Dynamic edge-conditioned filters in convolutional neural networks on graphs. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 3693–3702 (2017).
- 50.Veličković, P. et al. Graph attention networks. arXiv preprint arXiv:1710.10903 (2017).
- 51.Liu, M., Gao, H. & Ji, S. Towards deeper graph neural networks. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, 338–348 (2020).
- 52.Perez, H. & Tah, J. H. Improving the accuracy of convolutional neural networks by identifying and removing outlier images in datasets using t-sne. Mathematics8, 662 (2020). [Google Scholar]
- 53.Jin, Z. et al. GNNlens: A visual analytics approach for prediction error diagnosis of graph neural networks. IEEE Trans. Visual Comput. Gr.29, 3024–3038 (2022). [DOI] [PubMed] [Google Scholar]
- 54.Wang, H. E. et al. A systematic framework for functional connectivity measures. Front. Neurosci.8, 405 (2014). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 55.Schreiber, T. Measuring information transfer. Phys. Rev. Lett.85, 461 (2000). [DOI] [PubMed] [Google Scholar]
- 56.Scott, D. W. On optimal and data-based histograms. Biometrika66, 605–610 (1979). [Google Scholar]
- 57.Kale, P. et al. Prediction of multifocal epileptogenic zones using normalized transfer entropy. In 2017 IEEE Signal Processing in Medicine and Biology Symposium (SPMB), 1–4 (IEEE, 2017).
- 58.Zhang, X., Lei, X., Wu, T. & Jiang, T. A review of EEG and meg for brainnetome research. Cogn. Neurodyn.8, 87–98 (2014). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 59.Li, X. et al. BrainGNN: Interpretable Brain Graph Neural Network for fMRI Analysis. Med. Image Anal.74, 102233 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 60.Klepl, D., He, F., Wu, M., Blackburn, D. J. & Sarrigiannis, P. EEG-based graph neural network classification of Alzheimer’s disease: An empirical evaluation of functional connectivity methods. IEEE Trans. Neural Syst. Rehabil. Eng.30, 2651–2660 (2022). [DOI] [PubMed] [Google Scholar]
- 61.Klepl, D., Wu, M. & He, F. Graph neural network-based EEG classification: A survey. IEEE Trans. Neural Syst. Rehabil. Eng.32, 493–503 (2024). [DOI] [PubMed] [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Data Availability Statement
All data produced are available online at: (1) The OpenNeuro Epilepsy-iEEG-Multicenter-Dataset with accession number ds003029, accessible through https://openneuro.org/datasets/ds003029/versions/1.0.7; (2) The SWEC-ETHZ iEEG Database, accessible through http://ieeg-swez.ethz.ch/.




















