A Compact Graph Convolutional Network With Adaptive Functional Connectivity for Seizure Prediction

Seizure prediction using EEG has significant implications for the daily monitoring and treatment of epilepsy patients. However, the task is challenging due to the underlying spatiotemporal correlations and patient heterogeneity. Traditional methods often use large-scale models with independent components to capture the spatial and temporal features of EEG separately or explore shared patterns among patients with the help of pre-defined functional connectivity. In this paper, we propose a compact model, called the graph convolutional network based on adaptive functional connectivity (AFC-GCN), for seizure prediction. The model can adaptively infer evolution of functional connectivity in epilepsy patients during seizures through data-driven methods and synchronously analyze spatiotemporal response of functional connectivity in multiple topologies. On CHB-MIT datasets, the experimental results demonstrate that AFC-GCN achieves accurate and robust performance with low complexity. (AUC: 0.9820, accuracy: 0.9815, sensitivity: 0.9802, FPR: 0.0172). The proposed method has the potential to predict seizure during daily monitoring.


I. INTRODUCTION
E PILEPSY is a chronic neurological disorder character- ized by abnormal neuronal discharge, which can cause functional impairment of the brain [1].According to the latest report released by the World Health Organization, more than 50 million people worldwide have been diagnosed with epilepsy.More than 30% of patients with epilepsy cannot control seizures through either surgical intervention or medication [2].Long-term and frequent seizures can result in more severe brain damage and eventually evolve into refractory epilepsy, increasing the risks and difficulties of patient care [1].Seizures that occur suddenly in different scenarios can cause irreversible damage, such as asphyxia, cerebral ischemia, fractures, drowning, and even sudden death [3].Accurate seizure prediction can help patients find safe environments in advance and reduce the risk of injury.Timely warning of seizures can also prepare patients psychologically, alleviating their sense of inferiority [4].Therefore, designing effective methods for predicting seizures has significant clinical value and social significance.It can help clinical professionals conduct targeted prevention and intervention measures, reduce damage caused by seizures, and enhance patient care.
Using scalp EEG to monitor abnormal patterns of neural activity in neurons and functional connectivity (FC) can detect early signs of seizures, which is an effective and feasible way of seizure prediction [5].The principle of scalp EEG is to detect the electrical activity of neurons in the brain through electrodes placed on multiple points on the surface of the scalp [6].Compared to invasive intracranial EEG (iEEG) and other large-scale epilepsy diagnostic devices such as MEG, MRI, and CT, scalp EEG has the advantages of being noninvasive, portable, low-cost, and high temporal resolution.It can provide convenient and effective monitoring of seizures in hospital or home settings for patients with epilepsy [7].
Seizures arise from asynchronous "micro-seizure" within small clusters of neurons, which evolve into synchronized discharges across brain networks at multiple temporal and spatial scales, involving complex interactions between different types of neuronal populations [8].This evolution can be decomposed into four distinct phases in EEG: interictal, preictal, ictal, and postictal periods, shown as Fig. 1.The preictal period is considered a useful predictive window, during which changes in neural activity closely associated with impending seizures can be observed [9].Therefore, the core of seizure prediction can be conceptualized as a binary classification task that distinguishes between interictal and preictal states, while adhering to the constraints imposed by the seizure prediction horizon (SPH) and seizure onset period (SOP) [10].
Due to the intricate temporal and spatial evolution of EEG signals in patients with epilepsy, capturing preictal biomarkers in EEG signals is challenging.Therefore, data-driven methods have been employed for seizure prediction.Through this approach, many researchers have employed feature engineering based on empirical design to capture the characteristics of EEG signals for seizure prediction.This approach involves extracting temporal features such as amplitude and slope [11], frequency-domain features such as wavelet coefficients [12] and power spectra [13], and nonlinear dynamical features such as sample entropy [14] and approximate entropy [15].However, traditional feature engineering has certain limitations, such as being influenced by empirical factors and difficulty in adapting to strong individual differences among patients, making it difficult to establish a universal model.
Deep learning is a type of neural network that utilizes multiple layers of non-linear mappings, generating multiple levels of abstract features through the stacking of activation functions, allowing for automatic feature extraction from data [16].In seizure prediction, deep learning methods provide sufficient feature space capacity to automatically extract differential features from various stages of seizures.A large number of seizure prediction algorithms based on deep learning have been proposed.These algorithms analyze the spatiotemporal evolution of EEG signals within Euclidean space by analogizing the sequential features of the EEG signal to the height of an image and the orderly arranged channels to the width of an image.Zhao et al. [17] proposed an end-to-end model based on the CNNs framework that uses addition instead of the massive multiplication in the convolution process to reduce computational complexity.The model is trained by combining the supervised contrastive loss from the projection layer and the cross-entropy loss from the classification layer.The proposed method achieved good results on publicly available datasets.Gao et al. [18] proposed an end-to-end framework based on temporal-spatial multi-scale convolutional neural network with dilated convolutions for patient-specific seizure prediction.The method achieves good results in testing on 16 patients from the CHB-MIT dataset.Deng et al. [19] designed a deep learning framework based on a hybrid visual transformer to address the issue of ambiguous and noisy representations learned in epilepsy prediction tasks.The proposed method was validated on subsets of the CHB-MIT and Kaggle datasets.Li et al. [20] proposed an end-to-end seizure prediction method using multi-layer perceptron (MLP) that captures the spatiotemporal evolution of epileptic EEG through feature analysis in both width and height dimensions, with performance validated on subsets of the CHB-MIT and Kaggle datasets.
The FC in EEGs exhibit a non-Euclidean topology, which includes multiscale temporal and spatial correlations between different brain regions represented by different channels.However, traditional CNN-based frameworks are limited in their ability to explore FC features between brain regions due to the fixed structure of convolution filters and their local receptive fields.And CNN-based methods have limitations in accurately capturing specific patterns of fine-grained FC, due to the shared parameter space [21].Although RNNs have excellent information mining capabilities for long-term temporal signals, it is difficult to analyze FC with unknown node activation sequences.To address these issues, some researchers have proposed various new methods for predicting seizures using graph convolutional networks (GCNs) instead of the original CNNs, and have achieved promising results.GCNs aim to map EEG signals to graph space, with brain regions as nodes and inter-regional connectivity relationships as edges, in order to capture network changes during seizure processes.Wang et al. [22] mapped EEG to graph space using the phase locking value (PLV) as features, and constructed a spatiotemporal graph attention network based on graph attention mechanism (GAT) and gated recurrent unit (GRU).The proposed method achieved good results on both private and CHB-MIT datasets.Dissanayake et al. [23] mapped EEG signals to 2D graph space using L2 distance between sensors as features, and proposed a subject-independent seizure prediction model based on Geometric Deep Learning (GDL).The proposed model achieved good results on both the CHB-MIT and Siena-EEG datasets.Chen et al [24] mapped the EEG signals, which were decomposed by wavelet analysis, to graph space using the Pearson correlation coefficient (PCC) between channels as features, and proposed a multi-dimensional enhanced framework for seizure prediction.Their algorithm achieved good results on the CHB-MIT dataset.Although the aforementioned seizure prediction methods have achieved some good results, several obstacles remain to their clinical application.The main challenges are as follows: 1) The spatiotemporal evolution of FC during seizures is a dynamic and highly subject-specific process.Current approaches to computing adjacency matrices heavily rely on common domain knowledge, making them insufficient for capturing dynamic changes in epileptic EEGs, which can lead to unstable prediction results.2) Scalp EEG signals are vulnerable to background noise from eye movements, muscle activity, and electrode displacement.Although such noise is typically removed manually or through Independent Component Analysis (ICA), it can also inadvertently remove valuable information within the signals.
3) Seizure prediction is frequently used for real-time prediction of high-throughput signals, and overly complex models may be constrained by the computational power of edge devices.To tackle the aforementioned challenges, we present a patient-specific seizure predictor named graph convolutional network based on adaptive functional connectivity (AFC-GCN).Our method offers the following advantages: 1) For EEG graph mapping, our method can adaptively map EEGs to graph space and infer the seizure evolution patterns of FC through spatiotemporal graph.Meanwhile, this process can dynamically quantify the importance of each sensor without relying on prior knowledge.Thus bad channels and interference are automatically weakened, while pathological information relevant to seizures is enhanced.2) For graph modeling of seizure prediction, our approach obtains global and local spatial features of FC by superimposing the topological structure of different spatial scales.During the process, we have incorporated temporal information into each scale spatial feature to obtain spatiotemporal fusion features of the dynamic epileptic FC. 3) For real-time performance, our method designs compact classifier, which reduces computational complexity and time while ensuring the performance of seizure prediction.

II. METHODS A. Problem Definition
In this context, EEG from a patient is defined as an undirected graph G = (V, E, A), where |V | = c is a set of nodes representing the c-channel EEG sensors, E is a set of edges representing the connectivity between the EEG sensors, and A ∈ R c×c is corresponding binarized adjacency matrix inferred from E. In seizure prediction, the G is divided into T segments of equal length, where each subgraph X (t) G = V (t) , E (t) , A (t) , t = 1, . . ., T represents an EEG segment at the time step t, where E (t) = {e (t) i, j | (i, j) = 1, . . ., c}.It worth noting that, A is an adaptive adjacency matrix learned from the samples and varying over time in our algorithm, rather than a fixed value as used in traditional seizure prediction, such as PLV, PCC.The problem we aim to solve is to identify whether X (t) G belongs to interictal or preictal periods in EEGs.

B. Pipeline Overview
The AFC-GCN, as illustrated in Fig. 2, comprises three components: functional connectivity adaptive graph generation (FC-AGG), spatiotemporal graph feature analysis (SGFA), and compact classification network (CCN).The input consists of voltage vectors detected by EEG sensors at various scalp locations over a period of time.Using a fully-connected network topology, the input is mapped to an initial graph with adjustable parameters.Multiple modules of spatiotemporal graph feature analysis are applied to the initial graph to generating deep feature maps that synchronize both over time and space.Subsequently, the compact classification network categorizes the graph into the corresponding category of interictal or preictal periods of seizures.The model is trained in an end-to-end manner via backpropagation.The initial graph is optimized during the backpropagation process to produce dynamic FC describing the present brain state.

C. Functional Connectivity Adaptive Graph Generation
In existing graph-based models for seizure prediction, methods such as PCC, PLV, and L2 distance are used to calculate the E (t) .However, these methods are subjective to some   extent.On one hand, the pre-defined E (t) is unable to incorporate FC properties that are specific to the patient's current state.On the other hand, obtaining common information in this way also makes it difficult to highlight unique spatiotemporal patterns of FC during seizures.
In order to tackle the aforementioned issues, we introduce a module, named Functional Connectivity Adaptive Graph Generation (FC-AGG), which adaptively infers the dynamic FC from spatiotemporal response.The FC-AGG module is specifically designed to address the challenges of accurate and personalized seizure prediction by leveraging the patient's unique physiological and pathological features.To begin with, FC-AGG initializes learnable node embedding dictionaries E s ∈ R c×d for all sensors, where d represents the dimension of the node feature.Afterwards, the E s that has undergone two non-linear mappings is adjusted during the backpropagation to infer node embedding representations that align with the current brain state.Then, similar to defining a graph based on node similarity, we obtain a symmetric matrix E (t) representing the FC by multiplying E s with its transpose matrix.
To preserve the integrity of valuable information in EEG signals, our model refrains from using manually-designed preprocessing methods to remove interferences such as bad channels, artifacts, and background noise.Instead, we employ a nonlinear combination of ReLU(•) and Tanh(•) to penalize weak coupling relationships among sensors that are irrelevant to FC.The adjacency matrix representing epileptic FC is then adjusted by Tanh(•) to (−1, 1), and ReLU(•) automatically prunes weak connectivity with values less than 0 while retaining strong connectivity that are non-negative, i.e., coupling connectivity among EEG sensors related to seizures.
Finally, to reduce computational complexity and highlight important FC, we obtain the adjacency matrix A (t) by sparsifying E (t) using a threshold ε. which is then normalized.
For FC, the degree of nodes (i.e., the number of nodes associated with a given node) may vary significantly.Directly using A (t) for graph convolution could lead to features being weighted inappropriately.Hence, we normalize A (t) to address this issue.The normalized adjacency matrix L (t) can be formulated as: where D is the degree matrix of A (t) , I c is identity matrix, c is the number of EEG sensors.It is worth noting that each node in EEGs is the result of aggregating and weighting discharges from multiple neurons.To prevent neglecting the node's own features, we have added a self-loop I c to the adjacency matrix A (t) .

D. Spatiotemporal Graph Feature Analysis
During the spatiotemporal evolution of FC, a node not only influences its neighboring nodes at the current time step, but also potentially affects itself and its neighbors in the next time step [25].In other words, the propagation of epileptic information in FC occurs simultaneously in both temporal and spatial dimensions.Due to the constraints of spatial distance and the range of time series between nodes, these complex spatiotemporal correlations are typically local and irregular.Existing seizure prediction methods often use two independent modules to capture the temporal and spatial correlations of the network separately.However, we believe that if these local and irregular spatiotemporal correlations could be simultaneously captured, it would be more advantageous to deal with the spatiotemporal heterogeneity that exists in individual seizure.
Drawing on the reasons stated above, we develop a spatiotemporal graph feature analysis module (SGFA) to capture the spatiotemporal correlations of FC during seizures.SGFA comprises a series of spatiotemporal graph convolutions, where each node weights and aggregates the features of its neighbors to uncover the local spatiotemporal features of the graph.The input to SGFA is the FC graph generated by FC-AGG.First, the node features in the initial graph are selectively aggregated and enhanced under the guidance of node coupling strength via the spatial analysis module f spatical (•).Subsequently, the enhanced graph is fed into the spatiotemporal analysis module f spatiotemporal (•), which maps it to a high-dimensional non-linear space to extract the spatiotemporal dynamic features of the graph.Our model analyzes the spatiotemporal features of FC graph from local to global by stacking multiple SGFA modules.To avoid the gradient vanishing that may arise from stacking multiple GCNs, we incorporate a residual connection res(•) into SGFA, taking inspiration from the design of ResNet.The residual connection passes the input of a module in parallel to the next module through a learnable identity mapping, which adds a space for fusing local and global features, avoiding overfitting and the disadvantage of local features being easily ignored in deeper layers.The SGRA can be formulated as follow: where, N i = {v j |d v j , v i = 1} denote the set of nodes neighbor to node v i , t is the length of the temporal feature window, c in is the depth of input channels, k is the depth of output channels, G denote a vertex in FC graph.Each node is regarded as a vertex and its aggregation-weighted relationship with neighboring nodes is computed.σ (•) denote the activation function exponential linear unit (ELU).

E. Compact Classification Network
Epilepsy types and seizure patterns exhibit significant individual differences among patients [26].Moreover, seizures are often influenced by both internal and external factors, such as medication status, sleep cycle, circadian rhythm, and physiological condition [27].As a result, existing seizure prediction algorithms are typically tailored, adjusted, and optimized for individual patients.However, acquiring personal EEG data, especially during seizure episodes, is often challenging, which necessitates seizure prediction algorithms with a low parameter count and high prediction performance.Additionally, since seizure prediction algorithms are usually deployed on edge or cloud-edge collaborative devices for daily dynamic monitoring of patients, they require real-time processing capabilities for high-throughput EEG data.
Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.

TABLE I THE PARAMETER OF AFC-GCN
Given the practical issues encountered in predicting seizures, we propose a compact classification network (CCN) inspired by EEGNet [28] to classify the spatiotemporal feature graph generated by the SGFA module.We first employ depthwise convolution to perform weighted aggregation on the feature graph, where the size of the convolution kernel (c, 1) is equal to the number of nodes in the graph, and average pooling is conducted to downsample the temporal dimension.Since depthwise convolutions are not full-connected to the each nodes in the previous feature graph, it effectively reduces the number of trainable parameters.Moreover, depthwise convolutions can efficiently explore the probability of FC circuits related to seizures, as they provide an independent filter for each local graph combination in the feature graph.Next, we employ a separable convolution module, which comprises a depthwise convolution with a size of (1, f /2) to capture the temporal evolution of FC in a 500ms time window, and a point convolution with a size of (1, 1).Separable convolution divides the traditional convolution process into two steps: the depthwise convolution is used to learn the internal spatiotemporal relationships of each local graph combination, while the point convolution aggregates the different local graph combinations in the optimal way.In comparison to traditional convolution, the concatenation of the above two convolution operations can reduce the number of learnable parameters and computational cost, while maintaining model performance.Finally, the feature graph is fed into a fully connected network for aggregation, and a sigmoid activation function is applied to output the probability vector.

F. Implementing AFC-GCN
The AFC-GCN consists of a FC-AGG, three SGFAs, and a compact classification network.First, the EEG segments are processed by the FC-AGG module to calculate the adjacency matrix that characterizes FC.The adjacency matrix and the original data are combined to construct the spatiotemporal graph.Then, the spatiotemporal graph is fed into SGFA for feature analysis.The channel depth of each SGFA layer is 8.To prevent overfitting and improve the generalization ability of the module in different environments and patient states, half of the node features are randomly dropped out after each SGFA.Meanwhile, to prevent gradient vanishing or explosion caused by the depth of the network, we use the residual mechanism on each SGFA module.Finally, the spatiotemporal graph, which is mapped by SGFA features, is fed into the compact classification network to predict epileptic seizures, and the prediction results are mapped to probabilities between 0 and 1 using sigmoid.In the compact classification network, we utilize average pooling with a size of (1,128) to capture the evolving features of FC under different time windows, taking into account the EEG signal sampling frequency of f = 256 Hz.Furthermore, as the AFC-GCN utilizes sigmoid as the final activation function, binary cross-entropy is chosen as the loss function during model backpropagation.The specific parameter settings of AFC-GCN are shown in Table I.

A. Datasets and Experiment Settings
The experiment is conducted on the CHB-MIT dataset (https://www.physionet.org/content/chbmit/1.0.0/) [29] and siena scalp EEG database (https://physionet.org/content/sienascalp-eeg/1.0.0/) [36].CHB-MIT dataset is a publicly available scalp electroencephalogram (EEG) dataset collected collaboratively by the Massachusetts Institute of Technology (MIT) and Boston Children's Hospital (CHB).The dataset includes EEG recordings from 24 patients (23 unique patients, with two recordings from the same patient at different time points) with epilepsy, totaling 181 seizures, with durations ranging from 9 to 42 hours.All signals are sampled at a frequency of 256 Hz, and the electrode placement followed the 10-20 system.Siena dataset comprises EEG recordings from 14 epilepsy patients.The subjects consist of 9 males (ages ranging from 25 to 71 years) and 5 females (ages ranging from 20 to 58 years), who were monitored with video-EEG using electrodes arranged according to the international 10-20 system, with a sampling rate of 512 Hz.The majority of the recordings also include one or two EKG signals.The diagnoses of epilepsy and the classification of seizures within the dataset were determined by experts following a thorough review in accordance with the criteria set by the International League Against Epilepsy.Furthermore, the dataset provides detailed information regarding the patients' gender, age, type of seizures, the number of EEG channels, the number of seizures, and the total duration of the recordings.
The primary objective of seizure prediction is to differentiate between preictal and interictal states.Since the duration of preictal states varies among patients, the time range for labeling these two states is often set empirically.From a clinical perspective, it is important to have an appropriate intervention time before seizure, which allows for effective preventive measures and avoids undue panic for the patients [27].In this study, we refer to previous studies on epileptic seizure prediction [22], [30], and set the intervention time (i.e., the SPH) to 5 minutes.Then, we remove it from the training data.The possible seizure onset period SOP and postictal period are both set to 30 minutes.In other words, we aim to predict seizures between 35 minutes and 5 minutes before the onset of a seizure, with at least 1 hour interval between two seizures.

TABLE II DETAILS OF CHB-MIT AND SIENA DATASETS
Additionally, we only include patients who had between 2 and 10 seizures per day in our analysis.This decision is based on the fact that seizure prediction is not critical for patients who have an average of one seizure every 2 hours, and patients with fewer than 3 seizures would not provide enough data for the study.
Based on the aforementioned limitations, we select 17 patients from the CHB-MIT dataset, totaling 75 seizures with a duration of 194 hours.Meanwhile, we select 6 patients from the siena dataset, totaling 22 seizures with a duration of 61.06 hours.Detailed information is shown in Table II.Imbalanced class distribution is a common issue in seizure prediction datasets, with interictal periods typically outnumbering preictal periods by a large margin [27].To mitigate the impact of sample size bias on model training, we conduct data augmentation on preictal periods using time windows of 5 seconds with random overlap, and balance the proportions of interictal and preictal periods using random sampling.For both datasets, some patients used different electrodes.To ensure consistency among the samples in the datasets, we utilized a common set of 18 channels in the CHB-MIT dataset and a common set of 29 channels in the Siena dataset as the number of electrodes for the input samples.In addition, we downsample the EEG signals on siena dataset from 512Hz to 256Hz to reduce the computation cost.
To obtain an unbiased estimate of seizure prediction performance, we employ leave-one-out cross-validation (LOOCV) based on the number of seizures.Specifically, for a patient with N seizures, we perform the algorithm N times, using a different preictal period for testing each time and the remaining N-1 preictal periods for model training.The N-1 preictal periods were divided into two parts, with 80% used for training the model and 20% used for validation, during which the validation loss was recorded.We choose the adaptive moment estimation algorithm with mini-batch as the optimizer.Based on experience, the initial learning rate is set to 0.1 and reduced to one-tenth of its value if the validation loss did not decrease for 5 consecutive training iterations.And we set the batch size to 128, the beta1 and beta2 parameters to 0.91 and 0.999, respectively.Finally, the optimizer save the model with the lowest validation loss over 30 epochs.
The proposed model is trained and tested on a server equipped with an NVIDIA Tesla K80 GPU, running an Ubuntu 16.04 LTS system.The implementation is carried out using Python 3.7.16and the Pytorch 1.10.1 framework.MNE 1.3.0 is used to load and segment EEG signal.To preserve as much seizure-related information as possible in the EEGs, we choose not to perform artifact removal or bad channel deletion.Instead, we delegate these tasks to the FC-AGG, which complete them adaptively.

B. Performance Comparison With Classical Deep Learning
Many studies have shown that deep learning methods outperform traditional methods in the field of seizure prediction [17], [18], [30].Therefore, in this study, we only compare the performance of our model with some classical deep learning models.
A. EEGNet [28] is a compact and versatile CNN architecture specifically designed for analyzing EEG data.It has demonstrated superior performance in various brain-computer interface (BCI) tasks, including sleep staging and motor imagery, owing to its smaller parameter size and faster learning rate.EEGNet has become a commonly used baseline model in the field of EEG data analysis.
B. ST-MLPs [20] is a spatio-temporal MLP network for seizure prediction.This method automatically denoises and weights the raw EEG signal by learnable matrices, and separately analyzes the temporal and spatial responses of EEG through cascaded MLP layers.
C. CLEP [31] is one of latest end-to-end method using triple-attention and spatio-temporal-spectral CNN.This method achieves patient-specific seizure prediction by fusing EEG spatiotemporal representations across different subband.
The limitations of experimental environments and settings prevented us from directly comparing the performance of AFC-GCN with existing seizure prediction methods.Hence, we choose the two aforementioned models that have publicly available code and are reproducible for comparison experiments.The results of the experiments are presented in Table III.
On the CHB-MIT dataset, the AFC-GCN model exhibits exceptional performance while maintaining an extremely low false positive rate.On the Siena dataset, the performance variability among models is more pronounced.The AFC-GCN retains the highest mean AUC, ACC, and SEN, as well as the lowest FPR.Additionally, it is noteworthy that the mean FPR for all models on the Siena dataset has increased, which may suggest that the prediction difficulty for epileptic seizures in adults, as compared to pediatric epilepsy, has been heightened.
To further demonstrate the performance of the models, we use a boxplot to visualize results on CHB-MIT dataset, Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.

TABLE III OVERALL PERFORMANCE ON CHB-MIT AND SIENA DATASET
which has a larger sample size, as shown in Fig. 5.The results suggest that our proposed method achieves not only the highest average performance, but also exhibits stable and robust performance across most patient datasets (15/17).Only two outlier groups corresponding to patients 5 and 21 are observed in the plot.On these two datasets, our method did not maintain an average prediction AUC of 98.2%, but still achieved accuracy of 94.9% and 86.3%, respectively.These results demonstrate the effectiveness of our graph modeling approach in predicting seizures through FC, and its potential as a reliable tool for clinical applications.

C. Performance of FC-AGG Module
We propose an adaptive graph generation module (FC-AGG) for inferring FC in seizure prediction.To verify the contribution of FC-AGG to seizure prediction, we design four models with different adjacency matrices for comparative analysis.Except for the adjacency matrix, the designed models have the same structure and hyper-parameters as AFC-GCN.The FCNT employ an adjacency matrix with all elements set to 1, assuming strong associations between all sensors in the EEG.The PCC, L1 and L2 employ three different methods to calculate the static FC respectively.The PCC employs Pearson correlation coefficient, which measures the linear relationship between EEG sensors.The L1 employs Manhattan distance, which evaluates the similarity between EEG sensors based on the sum of absolute differences along each dimension.The L2 employs Euclidean distance, which evaluates the similarity between EEG sensors via calculating the shortest geometric path in a multidimensional space.The LOOCV testing is performed on the 17 patients, and the results are shown in the Fig. 6.
Due to space limitations, only the average results of the test are shown in the table, and the results of the 17 patients are presented in the form of box plots.In order to retain as much seizure-related information as possible, the data used in the testing are not preprocessed to remove artifacts or bad channels.As a result, the model utilizing FCNT exhibit the lowest performance among the five models due to limitations in noise robustness and FC analysis.The performance of the three methods for calculating static FC (PCC, L1, and L2) is approximately comparable.The PCC exhibits relatively higher variance with a greater number of outliers, while the L2 demonstrates the best performance.Discernible from the dispersion in the boxplots, all three static methods of calculating FC exhibit lower performance stability compared to the FC-AGG model and are unable to consistently achieve good performance across all tested patient datasets.

D. Performance of SGFA Module
Due to the local and irregular spatiotemporal heterogeneity during seizures, we proposed the SGFA module with residual connections to synchronously capture the spatiotemporal evolution patterns of FC.In this section, we further compare the AFC-GCN, i.e.CCN+GCN+res, to CCN and CCN+GCN for verifying effectiveness of SGFA.CCN completely removes SGFA from AFC-GCN and only extracts seizure-related features by exploring the raw EEGs.CCN+GCN only removed the residual connections from SGFA, enabling it to explore the  spatiotemporal evolution of FC.However, due to the stacking of multiple GCNs, the high-level features tend to describe global changes in FC, ignoring local changes.The remaining settings of the above models are identical to AFC-GCN.The LOOCV testing is performed on the 17 patients, and the results are shown in the Fig. 7.
The results demonstrate that CCN+GCN+res achieves the best performance on all metrics, exhibiting robust performance in 15 out of 17 patients.CCN+GCN performs the second best, albeit with inadequate robustness, but outperforms CCN on all metrics.The addition of GCN enhances the overall performance of the model.The spatiotemporal graph constructed by the GCN in non-Euclidean space makes it easier to capture the patterns of FC during seizures.The model performance is further improved by the combination of residual connections and GCN.At the same time, the robustness of the model is significantly enhanced.The results suggest that the residual connections in SGFA effectively combine local and global features in a data-driven manner, which helps to alleviate overfitting and improve the generalization ability of AFC-GCN.

E. Performance of CCN Module
We propose a compact classification network (CCN) for real-time classification of preictal and interictal periods during seizures with low computational requirements.The CCN module includes depthwise convolutions and separable convolutions, which differ from normal convolutional networks.To verify the contribution and real-time of the CCN to the model, we replace the special convolutions with normal convolutions while maintaining the same settings as AFC-GCN.The LOOCV test is conducted on 17 patients, and the results are shown in the Fig. 8.
Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.In Fig. 8, the average results in the table show that Compact outperforms Normal in all indicators.Moreover, Compact has approximately 40% fewer parameters and takes 42% less time per single sample (5-second EEG segment) than Normal, meaning that it is both more lightweight and more efficient while maintaining high performance.The boxplots demonstrate the performance distribution of the two models on 17 patient datasets, indicating that both models achieve robust performance, but Compact performs better.

F. Effects of EEG Segment Length
The EEG segment length directly determines the amount of temporal information contained within the samples, which in turn affects the final performance of the model.An excessively short length may lead to the loss of original information, while an excessively long length can result in unnecessary performance degradation for the model.To explore the impact of segment length on the final performance, we set the segment lengths to 1 second, 2.5 seconds, 5 seconds, 7.5 seconds, and 10 seconds, respectively, and conducted LOOCV test on 17 patients.
The results are shown in Figure 9.It can be observed that as the segment length increases, the performance of the model also improves.While the segment length is greater than 5 seconds, the improvement in performance becomes negligible.The possible reason is that the effective information related to the seizure prediction can be captured by the model within 5-second segment.Although we do not deny that with further increase in slice length, the model could learn more temporal features and there may still be potential for performance improvement, we chose 5 seconds as the EEG segment length accepted by the model, considering the computational cost.

G. Performance of Cross-Subject Experiments
The aforementioned experiments based on LOOCV demonstrate the potential performance of the AFC-GCN model in patient-specific seizure prediction.To further assess the generalization capability of model to new patients, we employ a leave-one-subject-out (LOSO) strategy for cross-subject validation.Specifically, for a dataset comprising N patients, this strategy tests the model performance on the data of one patient at a time, with the classifier trained on the data from the remaining N-1 patients, executed N times, ensuring no overlap between the training and testing datasets.The LOSO cross-validated result is as shown in Table IV.
Although the performance of all models in LOSO testing has declined compared to LOOCV, the AFC-GCN model continues to consistently demonstrate excellent performance, which to some extent proves that our proposed model has the potential to predict seizures in prospective study.In addition, we have also noticed that the performance of AFC-GCN and CLEP, which utilize brain functional connectivity to mine the spatiotemporal representation of EEG, is significantly higher than the corresponding metrics of other models on both datasets.

IV. DISCUSSION
In this study, we develop a binary classifier for the task of seizure prediction by classifying perictal and interictal periods.First, the proposed method maps the raw EEG signals to graph space and infers dynamic FC of epilepsy patient by adaptive graph generation.Then, graph feature analysis module synchronously analyzes the evolution patterns of FC from spatial and temporal dimensions.Finally, the analysis results are fed into a compact classification network to make decisions (preictal or interictal).
The results in Fig. 6 demonstrate the effectiveness of the data-driven approach for inferring dynamic FC.The FCNT, which uses a fully connected adjacency matrix, analyzes FC patterns in a way that is similar to common CNN operation in Euclidean space.The PCC, L1 and L2 distance methods are common approaches for analyzing EEGs in graph space, which integrates prior knowledge.The performance comparison between the five methods highlights the importance of FC in graph space for seizure prediction.Although among the three methods for computing static FC, the L2 distance-based approach has demonstrated the most promising performance, it still exhibits a relatively high variance than our proposed FC-AGG module.This reflects the possibility that relying solely on predefined methods to quantify the spatiotemporal evolution of FC may be insufficient to address the irregular spatiotemporal characteristics and patient heterogeneity present throughout the entire seizure process (interictal, preictal, ictal and postictal).Our proposed FC-AGG module is a data-driven approach for adaptively inferring FC.FC-AGG exhibits superior performance over other methods with lower variance on different patient datasets.One potential explanation is that the adaptive graph generation of our proposed method can automatically mitigate the impact of certain external factors, such as bad channels and artifacts, while enhancing the expression of seizure-related pathological information.
Moreover, the factors such as the patterns of epileptic seizures, the physiological states of the patients, the settings of signal recording, and the environmental differences during collection lead to significant heterogeneity among patients.This heterogeneity makes the difficulty of cross-subject epileptic seizure prediction far higher than subject-specific modeling [37].The dynamic FC obtained through data-driven methods is independent of prior knowledge and may discover unique features that match the task, environment, or individual.

TABLE IV LEAVE-ONE-SUBJECT-OUT CROSS-VALIDATED RESULTS
It has the potential to adapt to the influence of endogenous factors, such as patient specificity and dynamic changes of the same patient in different environments, and thereby achieve more robust and generalizable seizure prediction.The cross-population results in Table IV also substantiate the aforementioned viewpoint to a certain extent.It also explains why the two methods that did not use functional brain connectivity performed significantly worse in LOSO testing compared to CLEP and AFC-GCN.
The results in Fig. 8 not only validate the effectiveness of the CCN module but also demonstrate its fewer learnable parameters and lower complexity compared to common CNN.AFC-GCN can process a 5-second EEG segment on an older K80 GPU in just 6.1426ms, demonstrating its potential for real-time seizure prediction in 24-hour monitoring of epilepsy patients.Furthermore, AFC-GCN accurately and robustly predicts seizure with only 0.0172M learnable parameters, which is far less than the well-known classification models, such as VGGNet (about 100M) [32], ResNet (about 50M) [33], ViT (about 10M) [33].Even compared to some of the most advanced seizure prediction models currently listed in Table V, AFC-GCN has an order of magnitude fewer learnable parameters than them.
To demonstrate the overall performance of AFC-GCN, Table V summarizes the state-of-the-art seizure prediction methods on CHB-MIT dataset.The proposed method outperforms most of the existing methods with the least amount of parameters.Longer SOP and SPH may provide more time for the prediction model to detect changes in brain activity indicative of an impending seizure, which could improve the accuracy of the prediction.However, we have chosen a shorter SOP compared to existing methods, because excessively long time may lead to patient anxiety and unnecessary medical intervention.Furthermore, compared to methods in Table V, we refrained from utilizing an excessive number of epileptic seizure samples for assessing model performance.This caution is due to the fact that opting for seizure samples with minimal temporal separation could augment the data set size superficially, potentially resulting in an overestimated level of performance [26].On CHB-MIT database, the time intervals between some seizures are less than an hour.

TABLE V COMPARISON OF SEIZURE PREDICTION METHODS ON CHB-MIT DATASET
While the proposed method for seizure prediction demonsatisfactory performance, there is still scope for further improvement.First, the FC-AGG module infers an undirected graph that lacks directionality using a data-driven approach.In contrast, a directed graph can model the causal relationships and information flow directions between functional brain regions, providing more interpretable seizure prediction.Therefore, our next research plan is to focus on directed graph modeling methods for FC and corresponding graph analysis methods.Second, in the task of seizure prediction, a unified time range is usually defined empirically for the preictal period.Due to individual differences among patients, the labels for the preictal period often contain noise.Therefore, in future research, we will consider using learning strategies such as contrastive learning, which are different from fully supervised methods, to optimize our method for practical applications.Thirdly, while existing models have shown promising performance in patient-specific modeling, there is still room for improvement in dealing with individual patient variability and the diversity of seizures in cross-patient modeling.Therefore, in the future, we will attempt to introduce domain adaptation techniques to mitigate patient heterogeneity and construct learning strategies based on self-supervised or semisupervised approaches to obtain more generalized epileptic EEG representations.

V. CONCLUSION
Based on graph convolution network, we propose a novel method for seizure prediction.The method utilizes an adaptive graph generation module to infer functional connectivity of epilepsy patients at different periods of seizures from data.Based on this module, we further propose a spatiotemporal graph analysis module and its corresponding compact classification network, which can automatically capture node-specific temporal and spatial correlations without pre-defined functional connectivity.Experiments on the CHB-MIT and siena datasets demonstrate the potential of the proposed method to achieve accurate, stable, and real-time seizure prediction.

Fig. 1 .
Fig.1.The evolution of a seizure in scalp EEG.SPH means that seizure will occur after this time.SOP means that seizure may occur at some point within this time period.

Fig. 2 .
Fig. 2. Flowchart of proposed model.In signal segmentation, different segmentation methods for interictal or preictal data are shown.FC-AGG represents the processing of raw EEGs to adjacency matrix.The main process demonstrated in SGFA is the weighted aggregation of neighboring nodes.The structure of proposed compact classification network is shown in CCN.

Fig. 4 .
Fig. 4. Structure of three SGFAs in AFC-GCN.The SGFA includes two alternating steps of temporal and spatial analysis.

Fig. 7 .
Fig. 7.The boxplot and average of performance test with SGFA module.The average means the average performance of LOOCV testing on the 17 patients.

Fig. 8 .
Fig. 8.The boxplot and average of performance test with CCN module.The average means the average performance of LOOCV testing on the 17 patients."Compact" represents the AFC-GCN model using CCN, and "Normal" represents the model using normal convolutions.

Fig. 9 .
Fig. 9.The boxplots of performance across different segment lengths with their respective average performance metrics.