Next Article in Journal
Electrospun Nanofiber Membrane for Cultured Corneal Endothelial Cell Transplantation
Previous Article in Journal
Hereditary Optic Neuropathies: A Systematic Review on the Interplay between Biomaterials and Induced Pluripotent Stem Cells
Previous Article in Special Issue
SeizFt: Interpretable Machine Learning for Seizure Detection Using Wearables
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Time-Series Anomaly Detection Based on Dynamic Temporal Graph Convolutional Network for Epilepsy Diagnosis

School of Artificial Intelligence, Beijing University of Posts and Telecommunications, Beijing 100876, China
*
Author to whom correspondence should be addressed.
Bioengineering 2024, 11(1), 53; https://doi.org/10.3390/bioengineering11010053
Submission received: 23 October 2023 / Revised: 28 November 2023 / Accepted: 28 December 2023 / Published: 5 January 2024

Abstract

:
Electroencephalography (EEG) is typical time-series data. Designing an automatic detection model for EEG is of great significance for disease diagnosis. For example, EEG stands as one of the most potent diagnostic tools for epilepsy detection. A myriad of studies have employed EEG to detect and classify epilepsy, yet these investigations harbor certain limitations. Firstly, most existing research concentrates on the labels of sliced EEG signals, neglecting epilepsy labels associated with each time step in the original EEG signal—what we term fine-grained labels. Secondly, a majority of these studies utilize static graphs to depict EEG’s spatial characteristics, thereby disregarding the dynamic interplay among EEG channels. Consequently, the efficient nature of EEG structures may not be captured. In response to these challenges, we propose a novel seizure detection and classification framework—the dynamic temporal graph convolutional network (DTGCN). This method is specifically designed to model the interdependencies in temporal and spatial dimensions within EEG signals. The proposed DTGCN model includes a unique seizure attention layer conceived to capture the distribution and diffusion patterns of epilepsy. Additionally, the model incorporates a graph structure learning layer to represent the dynamically evolving graph structure inherent in the data. We rigorously evaluated the proposed DTGCN model using a substantial publicly available dataset, TUSZ, consisting of 5499 EEGs. The subsequent experimental results convincingly demonstrated that the DTGCN model outperformed the existing state-of-the-art methods in terms of efficiency and accuracy for both seizure detection and classification tasks.

1. Introduction

Anomaly detection is a well-established research topic that has attracted a lot of research attention for decades. Epilepsy, often seen in children and the elderly [1], manifests as temporary losses of consciousness, convulsions, spasms, or abnormal behaviors, severely disrupting the patient’s routine life. Electroencephalography(EEG), a non-invasive technique for diagnosing epilepsy, captures brain neural activities by recording electrical activities on the scalp [2], which is helpful for doctors to diagnose epilepsy, appraise treatment effectiveness, and predict relapses. However, the analysis of EEG signals is a complex and labor-intensive task that requires interpretation and classification by experienced and specially trained medical professionals or technicians. This process consumes a significant amount of time and resources. Accordingly, the development of automatic and computer-assisted algorithms for EEG-based epilepsy detection and classification can accelerate the diagnosis process and curtail treatment costs, bearing substantial practical significance.
The epilepsy seizure process can be categorized into four distinct phases [3]: the interictal, preictal, ictal, and postictal periods. During the interictal period, patients typically exhibit no symptoms. However, as they transition into the preictal stage, prodromal symptoms such as headaches and concentration difficulties may emerge. This phase potentially progresses to the vital ictal stage, characterized by symptoms, like cramps and convulsions. Finally, in the postictal stage, patients often experience symptoms, including fatigue and headaches. As demonstrated in Figure 1 below, the EEG frequencies markedly differ across these stages.
In the process of EEG data collection, traditional methods typically involve segmenting the EEG signal prior and directly inputting it into the model. The majority of previous studies have employed a standard time interval of either 60 s or 12 s for slicing the signals [4,5]. Subsequent to this slicing process, the segmented signals are labeled as either ‘seizure’ or ‘non-seizure’, which is a process termed as the generation of coarse-grained labels. The TUSZ dataset [6,7], on the other hand, provides more detailed labeling by marking the start and end points of epileptic seizures, thus producing labels for each individual time step of the EEG signal [6]. This comprehensive labeling technique is referred to as fine-grained labeling. Nevertheless, the current methodologies primarily focus on the coarse-grained labels generated from segmented EEG fragments [4,5], thereby neglecting the rich information contained in the fine-grained labels of the original, unsegmented EEG signals.
With the advent of deep learning, the current methodologies frequently employ EEG signals as training data, leveraging advanced models for epilepsy-related research. Representative examples include recent studies that utilize convolutional neural networks (CNNs) [8,9] or recurrent neural networks (RNNs) [10,11] for seizure detection and classification tasks. However, these techniques have their limitations. The EEG signals are collected from multiple channels, so the signals are not independent of each other. These methods primarily model the temporal features but tend to ignore their spatial characteristics, leading to a decrease in detection accuracy. In response to this challenge, graph neural networks (GNNs) are introduced to capture the spatial information of EEG data. For instance, Tang et al. [4] proposed two novel EEG graph structures and intended to capture both electrode geometry and brain connectivity. Raeisi et al. [12] integrate temporal features extracted from individual EEG signals with short- and long-range spatial interdependencies among EEG channels. These interdependencies are embedded within a graphical representation of multi-channel EEG data. Meanwhile, Tao et al. [5] incorporated dynamic networks to encapsulate the spatiotemporal features associated with the connectivity between different brain regions. Despite these innovative approaches yielding promising results, performance is still hindered by the inadequate modeling of dynamic graph structures and insufficient attention to fine-grained labels.
To overcome the aforementioned challenges, we introduce a novel framework, the dynamic temporal graph convolutional network (DTGCN), for the detection and classification of seizure zones. More specifically, we initially employ a seizure attention module coupled with fine-grained labels to model both the distribution and diffusion patterns of epilepsy. Subsequently, we propose a graph structure learning methodology designed to extract dynamically evolving graph structures inherent in multivariate EEG signals. This approach is capable of profiling the intrinsic characteristics of dynamic connections within brain networks. Lastly, we utilize the temporal graph convolution network (TGCN) [13] to extract spatiotemporal features. In conclusion, the key contributions of our study can be summarized as follows:
  • We propose a dynamic temporal graph convolutional network (DTGCN) model, which is capable of detecting and classifying epilepsy using fine-grained labels and dynamic graphs. The effectiveness and superiority of our approach are substantiated through ablation studies and visualization experiments conducted on the TUSZ dataset.
  • We design a seizure attention module that utilizes fine-grained labels to model the distribution and diffusion patterns of epilepsy and incorporates attention scores into the final loss function. This innovative approach encourages the model to concentrate more efficiently on abnormal time steps.
  • We devise a strategy for dynamically generating EEG graph structures using predefined graphs, thereby modeling the dynamic connectivity characteristics within brain networks. Furthermore, the rate of change in the graph structure can be modulated via parameters, enabling more flexible adaptation to varying scenarios.
The structure of the remaining sections of this paper is as follows: Section 2 provides an overview of the related work. In Section 3, we introduce the DTGCN framework in detail. The experimental results and corresponding analyses are presented in Section 4. Finally, we draw conclusions in Section 5.

2. Related Work

Over the past several decades, a wealth of research has been devoted to the automated detection and classification of epilepsy. The majority of these studies initially extract statistical features manually, followed by the application of traditional machine learning algorithms for seizure detection. For instance, Gotman [14] proposed the extraction of time-domain features based on the signal amplitude, mean value, and coefficient of variation. Alka et al. [15] suggested the extraction of frequency-domain features centered around the peak frequency and main frequency peak bandwidth. Azami et al. [16] introduced the idea of extracting nonlinear features rooted in multi-scale fuzzy entropy and sample entropy. These extracted features are subsequently fed into various classifiers for seizure detection and classification, such as support vector machines [17], Gaussian mixture models [18], and others. However, manual feature extraction is a labor-intensive process. EEG signals encompass multiple channels, rendering them multi-dimensional, which complicates their processing through these methods. Therefore, the accuracy and sensitivity of traditional machine learning algorithms demonstrate certain limitations when applied to seizure detection and classification tasks.
In recent years, the advancement of deep learning technology has showcased strong generalization and adaptive learning capabilities in the realm of epilepsy research, thereby becoming the leading method in the field of seizure detection and classification. Most studies typically utilize conventional deep learning models, such as recurrent neural networks (RNNs) (Tsiouris et al. and Usman et al. [10,11]) and convolutional neural networks (CNNs) (Saab et al.; Ahmedt-Aristizabal et al. and Dhar et al. [8,9,19]). However, these methods have certain limitations. For example, RNNs neglect the structural features inherent in brain networks. CNNs presuppose that EEG signals adhere to a Euclidean structure—an assumption that disregards the natural geometry of EEG electrodes and the connectivity within the brain network. While some researchers have endeavored to optimize CNNs using strategies like a neural architecture search or pruning methods (Zhao et al. and Wang et al. [20,21]), guaranteeing model performance remains a significant challenge. As a result, an increasing number of studies have begun employing graph neural networks for epilepsy research. In this context, Shan et al. [22] consider both the adjacency matrix of functional connectivity, derived from multiple EEG channels, and the corresponding dynamics of EEG channel signals simultaneously. They efficiently leverage the constrained spatial topology of functional connectivity and harness discriminative temporal information through 1D convolution.
The aforementioned epilepsy detection methods all presuppose that training and testing data share the same distribution. However, EEG signals across different individuals often exhibit considerable variation. To overcome this obstacle, certain studies have integrated the fusion of transfer learning with deep learning. For instance, Zhang et al. [23] converted the EEG signal into a time–frequency graph and transferred parameters from three existing CNN networks: VGG16, VGG19, and ResNet50. Zhu et al. [24] incorporated meta-learning into transfer learning to reduce the model training time via memory enhancement modules. Some other studies have adopted pre-training models. Tang et al. [4], for example, pre-trained the Encoder of their proposed seizure detection model using an epilepsy sequence prediction task, ultimately achieving superior results in comparison with the transfer learning method.

3. Methods

3.1. Problem Statement

In this paper, the EEG input data comprise sensor readings from M sensors over N time steps. We use X to denote our input data:
X = x 1 , , x i , , x N , X R N × M
where x i R M represents the signal acquired from M sensors at the i-th time step, forming an M-dimensional vector. For instance, if a segment of an EEG signal contains a 12 s or 60 s interval, the corresponding time steps N would be 12 × f and 60 × f , respectively, where f is the sampling frequency.
In this study, we formulate the representation of the EEG signal as a graph denoted by G = V , ϵ , W , where V corresponds to the set of sensors, ϵ signifies the set of edges, and W is the weight matrix. It is important to highlight that the weight matrix W is initially unestablished and is intended to be inferred through our novel model. Subsequently, we outline the primary objectives of our investigation as follows:
In the context of seizure detection, our primary objective involves predicting the presence or absence of a seizure within a given EEG clip. Additionally, our focus extends to seizure classification, wherein the aim is to categorize the specific type of seizure present within an EEG clip. Building upon insights from prior research [4], we adopt established methodologies. In order to comprehensively evaluate the performance of our proposed model across different temporal scales, we segment the original EEG signal into clips of 12 s and 60 s duration, corresponding to fast and slow analysis, respectively. This segmentation strategy enables us to explore the model’s proficiency in both rapid and prolonged detection as well as classification scenarios.

3.2. Framework of the DTGCN Model

Our DTGCN model aims to learn the distribution patterns of epilepsy and uncover the intricate connectivity modes within the brain network. As demonstrated in Figure 2, the proposed DTGCN method contains three key components: the seizure attention module, graph structure learning module, and temporal graph convolution network. Firstly, we establish the seizure attention module to reconstruct EEG signals, with the goal of emphasizing the distinguishing features between normal and abnormal signals. Subsequently, we integrate the spatial–temporal information within the hidden states of the TGCN and the reconstructions from the seizure attention module to learn the graph structure. Furthermore, the reconstructed signals and the learned weighted matrices serve as input features for the TGCN. Finally, classifiers are implemented to perform the seizure detection and classification tasks. The well-structured framework effectively captures both the temporal dynamics and spatial connectivity patterns within the EEG data.

3.3. Seizure Attention Module

As shown in Figure 3, in the context of a signal segment featuring epileptic seizures, the coarse-grained label ‘1’ signifies the presence of epileptic seizures within this segment. Meanwhile, the fine-grained label [ 0 0 0 … 1 1 1 … 0 0 0 ] precisely denotes the specific time points of seizure onset. The previous studies only use the coarse-grained labels in the training process, i.e., the ground truth label of a EEG segment. However, they ignore the fine-grained labels, i.e., the ground truth labels of each time step within one segment [4,5]. The fine-grained labels for each time step reflect the distribution and spread patterns of epilepsy. In order to effectively capture the seizure pattern, we construct a seizure attention module and propose a constrained reconstruction loss based on the fine-grained labels in our training objective function.
As shown in Figure 2 (A), the raw EEG signal X R N × M is input into the multi-head attention module, and then we can obtain the reconstructions as follows:
Q , K , V = W Q , W K , W V X S = S o f t m a x Q K T d m o d e l X = S V , X R N × M
where Q , K , V R d m o d e l × N represent the query, key, and value in the self-attention mechanism. S is the attention score and X represents the reconstructed signal.
To learn the distinguishing features of EEG signals, we add the reconstruction loss and constrained loss based on fine-grained labels between raw signals X and reconstructed signals X . Specifically, we define time steps with high reconstruction errors as anomaly instances, drawing inspiration from the previous research on anomaly detection methodologies [25,26,27], which can be formulated as x t x t 2 > τ , x t R M , and τ is the optimal threshold. To determine the optimal threshold τ , we employ a dynamic search approach. Within the training dataset, we uniformly sample 50 values spanning from the minimum to the maximum of the 2 norm x t x t 2 . From this set of values, we select the threshold τ that yields the most favorable performance on our validation set. Locate the place with large reconstruction loss as the time step of epileptic seizure. This process can result in a set of fine-grained labels.
Then, we add constraints to the loss to minimize the difference between the true distribution of epilepsy and the model-predicted distribution of epilepsy as follows:
T 1 = t | l a b e l f i n e g r a i n e d = 1
T 2 = t | x t x t 2 > τ
L r e = X X 2 + c r a d ( T 1 ) c r a d ( T 2 ) / n
where T 1 denotes the aggregation encompassing all the time steps corresponding to the actual seizures, T 2 denotes the ensemble encompassing all the temporal steps attributed to the projected seizures, l a b e l f i n e g r a i n e d represents fine-grained labels, and c r a d represents the number of elements in the collection.
The first term of L r e is the standard reconstruction loss, which preserves the informative features inherent in the raw EEG signals. The second term is the regularization, which can highlight the discrepancy between seizure signals and normal signals and thus generate discriminative features for further modules. The architecture of the seizure attention model empowers the framework with robust capabilities for discriminating between normal and abnormal data.

3.4. Graph Structure Learning Module

The intricate connectivity of neurons within the brain is inherently influenced by diverse spatiotemporal relationships. Therefore, it is natural to describe the connection network of neurons in the brain from a dynamic perspective. In response, we designed a network that generates dynamic graphs for constantly updating dynamic adjacency matrix E t . This dynamic adjacency matrix accounts for the fluctuations in the network’s connectivity over time. In order to effectuate this, we transform the original time series X into a sequence of windows V t . For a window of length K, the input after adding the window is expressed as:
V t = x t K + 1 , , x t 1 , x t
I t = V t | | H t 1
where | | represents the concatenation operation, H t 1 represents the hidden-state output by the gated recurrent unit at the previous time step, and we regard I t as a dynamic node feature input to the graph convolution module:
D F t = θ G I t
where θ G represents the graph convolution on a predefined graph G, which can carry out the message-passing process of the dynamic node features. We choose Dist-Graph [4] as our predefined graph, and its adjacency matrix is calculated from the distance between nodes.
In practice, we generate the dynamic features of the source node D E t 1 and the destination node D E t 2 , respectively, and then calculate the dynamic adjacency matrix E t according to the similarity between the nodes. While considering that, the change rate of the brain network should not be too fast. For time step t 1 and time step t, our graph structure should not change much. So, we average the dynamic adjacency matrix of N consecutive time steps to obtain the adjacency matrix M t of the node graph structure at time t, denoted as follows:
D E t 1 = t a n h α D F t 1
D E t 2 = t a n h α D F t 2
E t = R E L U t a n h α D E t 1 D E t 2 D E t 2 D E t 1
M t = E t n + + E t 1 + E t / n
where α is a hyper-parameter to control the saturation rate of the activation function to ensure the sparsity of the graph.

3.5. Temporal Graph Convolution Network

We adopt the TGCN [13] to model the spatiotemporal dependence of EEG signals, which is a neural network that combines the graph convolution and gated recurrent unit (GRU), originally developed for traffic prediction in urban road networks. Specifically, the graph convolution part is used to learn complex topological structures for learning spatial correlation, and the gated recurrent unit is used to learn dynamic changes in EEG signals for temporal correlation. In terms of the specific implementation, the convolutional section of the GRU is modified as the graph convolutional section:
u t = σ W u θ G I t , h t 1 + b u
r t = σ W r θ G I t , h t 1 + b r
c t = t a n h W c θ G I t , r t h t 1 + b c
h t = u t h t 1 + 1 u t c t
Among them, u t and r t are the output of the update gate and the reset gate at time t; w and b represent the weight and bais trainable parameters; h t is the output of the TGCN module at time t and is sent to the graph generation module and TGCN-cell as the hidden state at time t + 1. We take the output at the last moment as the final output vector of the model and send it to the downstream classification. We employ cross-entropy to compute the loss for the epilepsy detection and classification tasks:
L θ = l o g p F X = e | θ m + λ L r e
where F X represents the classification result of the EEG fragment X output from the DTGCN model, and e is the real label of X, which represents different meanings in seizure detection and classification: the seizure detection task represents whether there is epilepsy, and the seizure classification task represents the type of epilepsy. θ m represents the model parameters that need to be trained, L r e represents the regularized reconstruction loss calculated by the seizure attention network, and λ represents the weight factor of this loss item.

4. Results Analysis

4.1. Experimental Dataset

We used the public Temple University Hospital EEG Seizure Corpus (TUSZ) v1.5.2 [6,7], which is the largest public EEG seizure database to date with 5612 EEGs, 3050 annotated seizures from clinical recordings, and eight seizure types. Following the settings of Tang et al. [4] in the TUSZ epilepsy detection experiment: we include 19 EEG channels in the standard 10–20 system, set the sampling frequency of the EEG signal to 200 Hz. In the process, we reclassified epilepsy categories within the original dataset into four distinct classes: CF (comprising focal non-specific (FN), simple partial seizure (SP), and complex partial seizure (CP)), GN (representing generalized non-specific seizure), AB (indicating absence seizure), and CT (denoting tonic-clonic seizure with tonic seizure combined into a single CT seizure class). To evaluate model generalizability to unseen patients, we exclude five patients from the official TUSZ test set who exist in both the official TUSZ train and test sets. The dataset statistics are shown in Table 1. Column EEG Files indicates the number of EEG files, and the percentage of files containing epilepsy in the total files is indicated in parentheses. Column Patients indicates the number of patients tested, and the brackets indicate the percentage of patients with epilepsy. The brackets in the total duration column indicate the proportion of epilepsy duration to the total EEG duration. The brackets in the CF seizure column indicate the number of patients with CF seizure.

4.2. Experimental Setup

We divided the train set from the official TUSZ dataset randomly into a train set and a verification set, maintaining a ratio of 9:1. Our experiments were conducted on a single RTX 3080 graphics card, and we utilized the Adam optimizer within the PyTorch framework. The learning rate was set at 5 × 10 5 , and we trained for 100 epochs. To ensure graph structure sparsity, we retained only five edges for each node. Should the verification loss fail to decrease consistently for five consecutive epochs, the model’s training was terminated prematurely.
According to some recent studies [4,5,28], we used the AUCROC and Weighted F1-score as the main evaluation metrics for seizure detection and classification, respectively. In order to comprehensively compare our DTGCN model with general CNN/RNN approaches and other graph theory-based methods, we chose the following baselines:
(1)
LSTM [10]: A variant of an RNN with gating mechanisms.
(2)
Dense-CNN [9]: A previous state-of-the-art CNN for seizure detection.
(3)
CNN-LSTM [8]: A CNN and RNN framework enhanced by using external memory modules with trainable neural plasticity.
(4)
STS-HGCN-AL [28]: A model that extracts hierarchical graphs via a spectral–temporal convolutional neural network and variant self-gating mechanism and then through the hierarchical graph network to capture the spatiotemporal characteristics of the rhythm.
(5)
Dist-DCRNN and Corr-DCRNN with pre-training [4]: They are two variants of the DCRNN [29], which, respectively, adopt two different mapping methods: mapping based on the real distance between electrodes and the correlation between EEG signals from different electrodes.
(6)
PLV+GCNN and Spatial+GCNN [12]: They represent models that integrate temporal features extracted from individual EEG signals with short- and long-range spatial interdependencies among EEG channels. PLV and Spatial are two variants of graph structures.

4.3. Overall Performance

Table 2 presents overall experimental results. DTGCN outperforms all the baseline models expect Dist-DCRNN on 12-s seizure classification. Our model achieves a slightly higher score compared to Dist-DCRNN and Corr-DCRNN, and significantly outperforms other methods. It’s important to note that while LSTM can capture sequence information and CNN can capture certain spatial structures, they do not accurately represent the complex structure of the human brain. STS-HGCN-AL, Dist-DCRNN, and Corr-DCRNN encode structural information within a graph framework. However, research has demonstrated that during a seizure event, the connectivity among a substantial number of brain neurons undergoes alterations [30]. While GCNN does consider long-range correlation, it also captures spatial correlation through static graph representations. These models tend to overlook fine-grained label information and the dynamic nature of brain networks. Even though our model’s performance on 12-second EEG signals after segmentation doesn’t match that of Dist-DCRNN, it’s worth noting that Dist-DCRNN benefits from pre-training via self-supervised tasks. In contrast, our DTGCN is trained from scratch, and its training time is notably shorter than that of Dist-DCRNN.
As depicted in Figure 4, our evaluation of the effectiveness of each model in classifying uncommon forms of epilepsy involves the presentation of confusion matrices. These matrices encapsulate the outcomes of both the baseline models and our DTGCN model within the context of 60 s seizure classification. In an effort to provide an unbiased perspective, each row within the confusion matrices has undergone normalization by division with the total number of examples corresponding to the respective class. In the graphical representation, the horizontal axis delineates the epilepsy category predicted by the model, while the vertical axis signifies the authentic epilepsy category label. Notably, our DTGCN model demonstrates a marked advancement of 4 points in contrast to the finest baseline in the AB category of rare epilepsy. Similarly, a noteworthy improvement of 5 points is evident in the CT category of rare epilepsy in comparison with the leading baseline. And the comprehensive classification performance has also improved.

4.4. Ablation Study

Since the Seizure Attention module and the Graph Structure Learning module are important components of our DTGCN, we study the impact of these two parts on the model performance. Table 3 shows the performance of DTGCN after we remove the Seizure Attention module and Graph Struct Learning module in DTGCN respectively. DTGCN is our original model, DTGCN w/o sz-atten removes the Seizure Attention module of the proposed framework. TGCN w Dist-graph removes the Graph Struct Learning module and the pre-defined graph is Dist-Graph. The experimental results presented are the averages of three independent experiments, and we provide the corresponding standard deviations.
Upon the exclusion of the Seizure Attention module, we observed a modest decline in the performance of the epilepsy detection task. In contrast, the epilepsy classification task exhibited a notable reduction in performance. This discrepancy can likely be attributed to the elevated significance of the epilepsy distribution information inherent in the fine-grained labels, particularly in the context of the classification task. This observation emphasizes the intrinsic value of our fine-grained labeling approach, as it effectively encapsulates pertinent details related to epileptiform patterns. Upon the omission of the Graph Structure Learning module, we opted to directly feed the pre-defined graph structure, denoted as Dist-Graph, into the TGCN module. This decision led to a pronounced plummet in the model’s performance. This notable decline serves as an indication that the dynamic graph, in contrast to the static graph, aligns more coherently with the inherent structural information present within the EEG signal. In summary, the absence of either the Seizure Attention module or the Graph Struct Learning module distinctly influences the achieved outcomes. This interdependence underscores the efficacy of our proposed methodology in enhancing the overall performance.

4.5. Effects of Parameters

In this section, we study the effects that different parameters and factors that can have impact on the performance of DTGCN. These experimental results are the average results of three experiments.
The first factor we study is how DTGCN responds to different data window sizes K. The window size has an impact on the types of seizures that can be detected, and directly affects the speed of epilepsy detection and classification, because larger windows mean more computation. Figure 5A summarizes the obtained results using five different window sizes: K ∈ [1, 5, 10, 20, 50]. The results show that DTGCN’s performance is relatively insensitive to window size and has a constant performance. It may be that our seizure attention module has already extracted the global latent information of this segment of the EEG signal, so the additional information captured is limited when faced with different window sizes. For our experiments, we selected a window size of 10. This is the best trade-off between the consumption of training resources and model performance.
The second aspect we examine pertains to how DTGCN adapts when averaging over different time steps, denoted as ‘n’. As described in the previous section, considering that the rate of change of the brain network should not be too fast, we average the elements of the dynamic adjacency matrix for n consecutive time steps to obtain the adjacency matrix of the graph structure at time t. Figure 5B presents the obtained results for five different values of n ∈ [1, 2, 4, 8, 16]. The best result was achieved for n = 4. When n is small, the structure of the brain network graph changes too quickly, and the structural information cannot be effectively fused with the temporal information, resulting in poor performance. In another extreme case, if we take a larger n, the effect is similar to that of a static graph, and the graph structure does not change much, resulting in a decrease in performance. At the same time, from the experimental results, the mid-range value of n seems to have little effect on the performance, showing relatively high and stable AUCROC and Weighted F1-Scores.
Finally, we investigate the effect of the weight factor λ of the reconstruction loss term, with a larger λ corresponding to greater emphasis on the seizure attention module in the model. Figure 5C shows the results of the different λ [0.1, 0.3, 0.5, 0.7, 0.9]. When λ is 0.3, the model achieves the best results.

4.6. Visualization Results and Interpretability

To investigate the practical significance of the learned graph structure and to compare the effectiveness of our method, we visually analyzed the average adjacency matrix produced by our DTGCN model alongside the best-performing DCRNN model from the baseline across the entire test set. This visualization encompasses instances of both correctly and incorrectly detected instances.
As shown in Figure 6A–C represent average connectivity matrix for no seizure, generalized seizure and focal seizures. Figure 6D represents the difference between focal seizure and non-seizure adjacency matrices and Figure 6E represents the difference between generalized seizure and non-seizure adjacency matrices. Comparing (D,E) of DTGCN in Figure 6, it can be found that the difference between the adjacency matrix of generalized seizure and no seizure is greater than that of focal seizure and no seizure, which indicates that generalized seizure can disrupt normal brain connections to a greater extent than focal epilepsy. This is consistent with the previous description in the literature: brain functional connectivity is significantly altered in global seizures [31]. Comparing (I,J) of DCRNN in Figure 6, we find that there is no obvious difference in their graph structures. In summary, The graph structure learned by our model can reflect epilepsy categories to some extent.

5. Conclusions

In this study, we propose a novel learning model DTGCN designed for the detection and classification of seizures through the fusion of dynamic graphs and gated recurrent units. Additionally, we present a method that leverages fine-grained label information to effectively model the distribution and diffusion patterns inherent in epilepsy. Notably, our model circumvents the need for a pre-training phase, substantially improving the performance of automated seizure detection and classification. Of particular significance, our model acquires a coherent graph structure that carries meaningful implications by accurately capturing the distinctions among various seizure categories. This feature contributes to the overall interpretability of our model. Our method eliminates the pretraining step and effectively improves the performance of automated seizure detection and classification. We anticipate extending our model to encompass other multi-channel sequential tasks, capitalizing on domain-specific knowledge to refine our graph structure learning module.

Author Contributions

Methodology, G.W. and H.Z.; writing—review and editing, G.W., K.Y., X.W. and S.S. All authors have read and agreed to the published version of the manuscript.

Funding

This work is partially supported by the National Natural Science Foundation of China under the Grant No. 62371057 and 61601046, the 111 Project of China under the Grant No. B08004, and the BUPT Excellent Ph.D. Students Foundation under the Grant No. CX2022149.

Informed Consent Statement

Informed consent was obtained from all subjects involved in the study.

Data Availability Statement

We used the public Temple University Hospital EEG Seizure Corpus (TUSZ) v1.5.2.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. WHO. Epilepsy. Available online: https://www.who.int/news-room/fact-sheets/detail/epilepsyjune201 (accessed on 8 July 2022.).
  2. Goldenberg, M.M. Overview of drugs used for epilepsy and seizures: Etiology, diagnosis, and treatment. Pharm. Ther. 2010, 35, 392. [Google Scholar]
  3. Gu, D.Q.; Yu, N. Postictal state and its clinical significance in epilepsy. Chin. J. Neurol. 2022, 55, 65–70. [Google Scholar]
  4. Tang, S.; Dunnmon, J.A.; Saab, K.; Zhang, X.; Huang, Q.; Dubost, F.; Rubin, D.L.; Lee-Messer, C. Self-supervised graph neural networks for improved electroencephalographic seizure analysis. arXiv 2021, arXiv:2104.08336. [Google Scholar]
  5. Tao, T.-L.; Guo, L.-H.; He, Q.; Zhang, H.; Xu, L. Seizure detection by brain-connectivity analysis using dynamic graph isomorphism network. In Proceedings of the 2022 44th Annual International Conference of the IEEE Engineering in Medicine & Biology Society (EMBC), Glasgow, UK, 11–15 July 2022; pp. 2302–2305. [Google Scholar]
  6. Shah, V.; Weltin, E.V.; Lopez, S.; McHugh, J.R.; Veloso, L.; Golmo-Hammadi, M.; Obeid, I.; Picone, J. The temple university hospital seizure detection corpus. Front. Neuroinform. 2018, 12, 83. [Google Scholar] [CrossRef] [PubMed]
  7. Obeid, I.; Picone, J. The temple university hospital eeg data corpus. Front. Neurosci. 2016, 10, 196. [Google Scholar] [CrossRef] [PubMed]
  8. Ahmedt-Aristizabal, D.; Fernando, T.; Denman, S.; Petersson, L.; Aburn, M.J.; Fookes, C. Neural memory networks for seizure type classification. In Proceedings of the 2020 42nd Annual International Conference of the IEEE Engineering in Medicine & Biology Society (EMBC), Montreal, QC, Canada, 20–24 July 2020; pp. 569–575. [Google Scholar]
  9. Saab, K.; Dunnmon, J.; Re, C.; Rubin, D.; Lee-Messer, C. Weak super-vision as an efficient approach for automated seizure detection in electroen-cephalography. Npj Digit. Med. 2020, 3, 59. [Google Scholar] [CrossRef] [PubMed]
  10. Tsiouris, K.M.; Pezoulas, V.C.; Zervakis, M.; Konitsiotis, S.; Kout-Souris, D.D.; Fotiadis, D.I. A long short-term memory deep learning network for the prediction of epileptic seizures using eeg signals. Comput. Biol. Med. 2018, 99, 24–37. [Google Scholar] [CrossRef] [PubMed]
  11. Usman, S.M.; Khalid, S.; Bashir, S. A deep learning based ensemble learning method for epileptic seizure prediction. Comput. Biol. Med. 2021, 136, 104710. [Google Scholar]
  12. Raeisi, K.; Khazaei, M.; Croce, P.; Tamburro, G.; Comani, S.; Zappasodi, F. A graph convolutional neural network for the automated detection of seizures in the neonatal eeg. Comput. Methods Programs Biomed. 2022, 222, 106950. [Google Scholar] [CrossRef]
  13. Zhao, L.; Song, Y.; Zhang, C.; Liu, Y.; Wang, P.; Lin, T.; Deng, M.; Li, H. T-gcn: A temporal graph convolutional network for traffic prediction. IEEE Trans. Intell. Transp. Syst. 2019, 21, 3848–3858. [Google Scholar] [CrossRef]
  14. Gotman, J. Automatic recognition of epileptic seizures in the eeg. Electroencephalogr. Clin. Neurophysiol. 1982, 54, 530–540. [Google Scholar] [CrossRef]
  15. Gotman, J.; Flanagan, D.; Zhang, J.; Rosenblatt, B. Automatic seizure detection in the newborn: Methods and initial evaluation. Electroen-Cephalography Clin. Neurophysiol. 1997, 103, 356–362. [Google Scholar] [CrossRef]
  16. Azami, H.; Fernandez, A.; Escudero, J. Refined multiscale fuzzy entropy based on standard deviation for biomedical signal analysis. Med. Biol. Eng. Comput. 2017, 55, 2037–2052. [Google Scholar] [CrossRef]
  17. Temko, A.; Thomas, E.; Marnane, W.; Lightbody, G.; Boylan, G. Eeg-based neonatal seizure detection with support vector machines. Clin. Neurophysiol. 2011, 122, 464–473. [Google Scholar] [CrossRef]
  18. Thomas, E.; Temko, A.; Lightbody, G.; Marnane, W.; Boylan, G. Gaussian mixture models for classification of neonatal seizures using eeg. Physiol. Meas. 2010, 31, 1047. [Google Scholar] [CrossRef]
  19. Dhar, P.; Garg, V.K.; Rahman, M.A. Enhanced feature extraction-based cnn approach for epileptic seizure detection from eeg signals. J. Healthc. Eng. 2022, 2022, 9825862. [Google Scholar] [CrossRef]
  20. Zhao, S.; Yang, J.; Sawan, M. Energy-efficient neural network for epileptic seizure prediction. IEEE Trans. Biomed. Eng. 2021, 69, 401–411. [Google Scholar] [CrossRef]
  21. Wang, H.; Zhu, X.; Chen, P.; Yang, Y.; Ma, C.; Gao, Z. A gradient-based automatic optimization cnn framework for eeg state recognition. J. Neural Eng. 2022, 19, 016009. [Google Scholar] [CrossRef]
  22. Shan, X.; Cao, J.; Huo, S.; Chen, L.; Sarrigiannis, P.G.; Zhao, Y. Spatial–temporal graph convolutional network for alzheimer classification based on brain functional connectivity imaging of electroencephalogram. Hum. Brain Mapp. 2022, 43, 5194–5209. [Google Scholar] [CrossRef]
  23. Zhang, B.; Wang, W.; Xiao, Y.; Xiao, S.; Chen, S.; Chen, S.; Xu, G.; Che, W. Cross-subject seizure detection in eegs using deep transfer learning. Comput. Math. Methods Med. 2020, 2022, 7902072. [Google Scholar] [CrossRef]
  24. Zhu, Y.; Saqib, M.; Ham, E.; Belhareth, S.; Hoffman, R.; Wang, M.D. Mitigating patient-to-patient variation in eeg seizure detection using meta transfer learning. In Proceedings of the 2020 IEEE 20th International Conference on Bioinformatics and Bioengineering (BIBE), Cincinnati, OH, USA, 26–28 October 2020; pp. 548–555. [Google Scholar]
  25. Han, S.; Woo, S.S. Learning sparse latent graph representations for anomaly detection in multivariate time series. In Proceedings of the 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, Washington, DC, USA, 14–18 August 2022; pp. 2977–2986. [Google Scholar]
  26. Malhotra, P.; Ramakrishnan, A.; Anand, G.; Vig, L.; Agarwal, P.; Shroff, G. Lstm-based encoder-decoder for multi-sensor anomaly detection. arXiv 2016, arXiv:1607.00148. [Google Scholar]
  27. Deng, A.; Hooi, B. Graph neural network-based anomaly detection in multivariate time series. In Proceedings of the AAAI Conference on Artificial Intelligence, Virtually, 2–9 February 2021; Volume 35, pp. 4027–4035. [Google Scholar]
  28. Li, Y.; Liu, Y.; Guo, Y.-Z.; Liao, X.-F.; Hu, B.; Yu, T. Spatio-temporal-spectral hierarchical graph convolutional network with semisupervised active learning for patient-specific seizure prediction. IEEE Trans. Cybern. 2021, 52, 12189–12204. [Google Scholar] [CrossRef] [PubMed]
  29. Li, Y.; Yu, R.; Shahabi, C.; Liu, Y. Diffusion convolutional recurrent neural network: Data-driven traffic forecasting. arXiv 2017, arXiv:1707.01926. [Google Scholar]
  30. Burns, S.P.; Santaniello, S.; Yaffe, R.B.; Jouny, C.C.; Crone, N.E.; Bergey, G.K.; Anderson, W.S.; Sarma, S.V. Network dynamics of the brain and influence of the epileptic seizure onset zone. Proc. Natl. Acad. Sci. USA 2014, 111, E5321–E5330. [Google Scholar] [CrossRef]
  31. Sun, J.; Li, Y.; Zhang, K.; Sun, Y.; Wang, Y.; Miao, A.; Xiang, J.; Wang, X. Frequency-dependent dynamics of functional connectivity networks during seizure termination in childhood absence epilepsy: A magnetoencephalography study. Front. Neurol. 2021, 12, 744749. [Google Scholar] [CrossRef]
Figure 1. Changes in EEG signals at different periods of seizure. The EEG signals in the blue box indicate the preictal period, the EEG signals in the red box indicate the ictal period, the EEG signals in between the two boxes indicate the postictal period, and the EEG signals elsewhere indicate the interictal period.
Figure 1. Changes in EEG signals at different periods of seizure. The EEG signals in the blue box indicate the preictal period, the EEG signals in the red box indicate the ictal period, the EEG signals in between the two boxes indicate the postictal period, and the EEG signals elsewhere indicate the interictal period.
Bioengineering 11 00053 g001
Figure 2. Framework of the DTGCN Model. X and X respectively denote the input and reconstructed output. V t is a sequence of windows sliced from X . H t 1 represents the output of TGCN at the ( t 1 ) t h time step. E t represents the adjacency matrix of the graph structure generated at the t t h time step. Gconv represents graph convolution. The upper right and lower right two different branches represent seizure detection and classification respectively.
Figure 2. Framework of the DTGCN Model. X and X respectively denote the input and reconstructed output. V t is a sequence of windows sliced from X . H t 1 represents the output of TGCN at the ( t 1 ) t h time step. E t represents the adjacency matrix of the graph structure generated at the t t h time step. Gconv represents graph convolution. The upper right and lower right two different branches represent seizure detection and classification respectively.
Bioengineering 11 00053 g002
Figure 3. Fine-grained and coarse-grained labels.
Figure 3. Fine-grained and coarse-grained labels.
Bioengineering 11 00053 g003
Figure 4. Confusion matrices of the baselines and DTGCN for 60 s seizure classification. The intensity of the color increases with the improvement of prediction accuracy, with darker hues corresponding to higher levels of accuracy.
Figure 4. Confusion matrices of the baselines and DTGCN for 60 s seizure classification. The intensity of the color increases with the improvement of prediction accuracy, with darker hues corresponding to higher levels of accuracy.
Bioengineering 11 00053 g004
Figure 5. The impact of parameter changes on model performance: (A) the window size K, (B) the time step n that needs to be averaged, and (C) the weight factor λ of the KL divergence loss item.
Figure 5. The impact of parameter changes on model performance: (A) the window size K, (B) the time step n that needs to be averaged, and (C) the weight factor λ of the KL divergence loss item.
Bioengineering 11 00053 g005
Figure 6. Mean adjacency matrix for EEG in the test set for (A,F) non-seizure EEG clips, (B,G) generalized seizures, (C,H) focal seizures, (D,I) difference between focal seizure and non-seizure adjacency matrices, and (E,J) difference between generalized seizure and non-seizure adjacency matrices.
Figure 6. Mean adjacency matrix for EEG in the test set for (A,F) non-seizure EEG clips, (B,G) generalized seizures, (C,H) focal seizures, (D,I) difference between focal seizure and non-seizure adjacency matrices, and (E,J) difference between generalized seizure and non-seizure adjacency matrices.
Bioengineering 11 00053 g006
Table 1. Summary of data in train and test sets of TUSZ v1.5.2. used in our study.
Table 1. Summary of data in train and test sets of TUSZ v1.5.2. used in our study.
EEG FilesPatientsTotal DurationCF SeizuresGN SeizuresAB SeizuresCT Seizures
(% Seizure) (% Seizure) (% Seizure) (% Seizure) (Patients) (Patients) (Patients)
Train Set4599 (18.9%)592 (34.1%)45,174.72 min (6.3%)1868 (148)409 (68)50 (7)48 (11)
Test Set900 (25.6%)45 (77.8%)9031.58 min (9.8%)297 (24)114 (11)49 (5)61 (4)
Table 2. Seizure detection and seizure classification results.
Table 2. Seizure detection and seizure classification results.
ModelSeizure Detection AUCROCSeizure Classification Weighted F1-Score
12 s 60 s 12 s 60 s
LSTM0.6290.5860.5760.601
Dense-CNN0.7860.7150.6520.679
CNN-LSTM0.7490.6820.6410.666
STS-HGCN-AL0.8090.7720.7070.714
Corr-DCRNN0.8560.8430.7230.741
Dist-DCRNN0.8610.8750.7470.750
PLV + GCNN0.8670.8710.7280.734
Spatial + GCNN0.8520.8500.7240.727
DTGCN(ours)0.8730.8890.7420.759
Table 3. Comparison of ablation experiments.
Table 3. Comparison of ablation experiments.
ModelSeizure Detection AUC/STDSeizure Classification Weighted F1/STD
12-s 60-s 12-s 60-s
DTGCN0.873/12.450.889/11.410.742/15.590.759/12.48
DTGCN w/o sz-atten0.869/10.850.883/8.230.726/12.170.732/9.93
TGCN w Dist-graph0.861/9.940.856/9.200.737/9.720.729/8.34
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Wu, G.; Yu, K.; Zhou, H.; Wu, X.; Su, S. Time-Series Anomaly Detection Based on Dynamic Temporal Graph Convolutional Network for Epilepsy Diagnosis. Bioengineering 2024, 11, 53. https://doi.org/10.3390/bioengineering11010053

AMA Style

Wu G, Yu K, Zhou H, Wu X, Su S. Time-Series Anomaly Detection Based on Dynamic Temporal Graph Convolutional Network for Epilepsy Diagnosis. Bioengineering. 2024; 11(1):53. https://doi.org/10.3390/bioengineering11010053

Chicago/Turabian Style

Wu, Guanlin, Ke Yu, Hao Zhou, Xiaofei Wu, and Sixi Su. 2024. "Time-Series Anomaly Detection Based on Dynamic Temporal Graph Convolutional Network for Epilepsy Diagnosis" Bioengineering 11, no. 1: 53. https://doi.org/10.3390/bioengineering11010053

APA Style

Wu, G., Yu, K., Zhou, H., Wu, X., & Su, S. (2024). Time-Series Anomaly Detection Based on Dynamic Temporal Graph Convolutional Network for Epilepsy Diagnosis. Bioengineering, 11(1), 53. https://doi.org/10.3390/bioengineering11010053

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop