DMNet: Self-comparison Driven Model for Subject-independent Seizure Detection
Authors: Shihao Tu
Linfeng Cao
Daoze Zhang
Junru Chen
Lvbin Ma
Yin Zhang
Yang Yang
Venue: NeurIPS 2024 poster (2024)
Keywords: seizure detection
domain generalization
Primary area: machine_learning_for_healthcare
TL;DR: DMNet is a self-comparison driven model designed for subject-independent seizure detection.

Abstract: Automated seizure detection (ASD) using intracranial electroencephalography (iEEG) is critical for effective epilepsy treatment. However, the significant domain shift of iEEG signals across subjects poses a major challenge, limiting their applicability in real-world clinical scenarios. In this paper, we address this issue by analyzing the primary cause behind the failure of existing iEEG models for subject-independent seizure detection, and identify a critical universal seizure pattern: seizure events consistently exhibit higher average amplitude compared to adjacent normal events. To mitigate the domain shifts and preserve the universal seizure patterns, we propose a novel self-comparison mechanism. This mechanism effectively aligns iEEG signals across subjects and time intervals. Building upon these findings, we propose Difference Matrix-based Neural Network (DMNet), a subject-independent seizure detection model, which leverages self-comparison based on two constructed (contextual, channel-level) references to mitigate shifts of iEEG, and utilize a simple yet effective difference matrix to encode the universal seizure patterns. Extensive experiments show that DMNet significantly outperforms previous SOTAs while maintaining high efficiency on a real-world clinical dataset collected by us and two public datasets for subject-independent seizure detection. Moreover, the visualization results demonstrate that the generated difference matrix can effectively capture the seizure activity changes during the seizure evolution process. Additionally, we deploy our method in an online diagnosis system to illustrate its effectiveness in real clinical applications.

DMNet: Self-comparison Driven Model for Subject-independen Seizure Detection
Shihao Tu Zhejiang University shihao. tu@zju. edu. en
Linfeng Cao The Ohio State University cao 1w780os.. edu
Daoze Zhang Zhejiang University zhangdzōzju. edu cn
Junru Chen
Lvbin Ma
Yin Zhang
Zhejiang University jrchen_ cali@zju. edu. en
Zhejiang Huayun
Zhejiang University y yinzh@zju. edu. cn
Information Technology Co. Ltd gmnmf 1y1163 com
Yang Yang
Zhejiang University yangyaězju.c edu.
Abstract
Automated seizure detection (ASD) using intracranial electroencephalography (iEEG) is critical for effective epilepsy treatment. However, the significant do- main shift of iEEG signals across subjects poses a major challenge, limiting their applicability in real-world clinical scenarios. In this paper, we address this issue by analyzing the primary cause behind the failure of existing iEEG models for subject-independen seizure detection, and identify critical universal seizure pattern: seizure events consistently exhibit higher average amplitude compared to adjacent normal events. To mitigate the domain shifts and preserve the universal seizure patterns, we propose novel self-comparison mechanism. This mechanism effectively aligns iEEG signals across subjects and time intervals. Based these findings, we propose Difference Matrix-based Neural Nenwork (DMNet), a subject- independent seizure detection model, which leverages seff-comparison based two constructed (contextual, channel-level) references to mitigate shifts of iEEG, and utilize simple yet effective difference matrix encode the universal seizure patterns. Extensive experiments show that DMNet significantly outperforms previ- ous SOTAs while maintaining high efficiency on real-world clinical dataset that we collected, as well as two public datasets for subject-independer seizure detec- tion. Moreover, the visualization results demonstrate that the generated difference matrix can effectively capture the seizure activity changes throughout the seizure evolution process. Additionally, we deploy our method an online diagnosis system to illustrate its effectiveness in real clinical applications.
Introduction
Epilepsy, chronic neurological disorder, affects more than 65 million people around the world. Up to 70% of people with epilepsy can be free from seizure only if the seizure onset zone (SOZ) can be located and surgically removed 26 To diagnose epilepsy, doctors rely the assessment of
CCorresponding authors.
38th Conference on Neural Information Processing Systems (NcurIPS 2024).

---

electrical activities that reflect the state and function of the subject's brain. Electroencephaloraphy (EEG) a widely employed and cost-effective method to record these electrical activities by placing sensors on the scalp. However, as non-invasive method, it is unable to accurately locate SOZ in the deep structures of the brain.
Nowadays, iEEG is widely employed to identify and locate SOZ. Stereo-EEG, one representative iEEG technique, involves the deep implantation of electrodes within the brain to record electrical activities. These electrodes contain multiple recording contacts, called chamnels, and are placed across different regions of the brain, which provide stereoscopic recordings of the brain from both cortical and subcortical structures simultaneously [3]] This fully developed technique has been proven to be both effective and safe [5].
Given a substantial volume of iEEG data, we present a pipeline tailored to real-world application scenarios for automated seizure detection (ASD), as depicted in Fig. (g). Firstly, the ASD model is trained using data from accessible subjects. Subsequently, the trained model is applied to identify seizures in iEEG recordings from previously unseen subjects. Doctors can refer to the prediction results, allowing for a more accurate diagnosis and facilitating more effective treatment decisions.
However, most existing ASD methods are built on non-invasive BEG with subject-specific set- ting [8 31 and subject-inder independent setting [2 [44] [T. However, these EEG-based methods are prone to failure when applied to iEEG data. This is primarily due to the significantly higher complex- ity of iEEG signals compared to EEG signals. iEEG signals exhibit a greater level of intricacy as result of the structural and functional disparities in brain neural activities. Furthermore, there variations in the number and placement of invasive electrodes (Fig. T (a.b)), leading to significant domain shifts across different subjects. However, Existing methods that employ domain adversarial training for subject-independee
seizure detection on iEEG signals may encounter negative transfer effects 23 27). Although [41] proposed method that utilizes series of intricate pre-training strategies to learn the general pattern across subjects, it lacks efficiency. Consequently, developing an effective and efficient subject-independent ASD method using iEEG is crucial for clinical diagnosis. Here, we discuss the primary challenges associated with iEEG in ASD.
Challenges. The factors mentioned above cause a significant domain shift between subjects, pos- ing an open question regarding the generaliza- tion of jubject-indeendeer epilepsy seizure de- tection using iEEG. This issue gives rise chal- lenges at both the subject level and the channel level:
PS Hlstreder
P4 PiEtttaa
(b)
PS Seloare
PC PESouee
(c)
(d)
(1) How to capture the general distinguishable representation for normal and seizures between different subjects and time intervals? Due to individual differences that exist among subjects, the inherent properties of iEEG recordings, such as amplitude, frequency, and others, person- alized to each subject. Even within the same individual, brain activities vary over time.
(e)
Onlix: Strien
DMINTE
Suntjetts
Uiitee Sunjects
(2) How to reduce the inconsistency of the seizure patterns of different channels? The chan- nels exhibit diverse patterns due to the iEEG records of various regions of the brain, poten- tially leading to conflicting patterns between subjects. For example, normal and seizure waves are indistinguishable between subjects or channels. As shown in Fig. [ the normal wave in (e) is difficult to distinguish from the seizure waves in (c) and (d), while the seizure event in (f) is often mistaken for the normal one. Therefore, the second challenge is to personalize the representations of brain activity independent of channels, allowing the model adapt different subjects.
Treatncci
Auaitarr diggensl
Figure (a, b) Locations iERG depth electrode contacts (red circle) for subjects P2 and P4. (c. d, e, f) Examples of seizure and normal iEEG recording activ- ities of subjects P2 and P4. (g) Application of our proposed method in real-world clinical scenarios.
2

---

Solution. To address these challenges, we first propose the mechanism of self-comparison comparing the target segment with adjacent normal segments. Subsequently, we conduct a comprehensive observation study (Sec. 3) to demonstrate the effectiveness of self-comparison. Our findings indicate that self-comparison can obtain a general distinguishable representation of normal ones and seizures.
Drawing on these inspirations, we argue that the self-comparison mechanism is the key to easily and effectively capture subject-invariant patterns between subjects. To this end, we propose a novel model, namely Difference Matrix based neural Network (DMNet), for subject-independenn seizure detection. Specifically, considering that different seizure events would present different neural activities (local bias) within different recording channels (global bias), we therefore introduce two reference objects (i.e., contextual reference and channel-leve reference). These references ensure that we can capture both local and global dependencies within data, which are the primary contributors of distribution shift and can be effectively mitigated through the self-comparison mechanism. Subsequently. we utilize simple yet effective fully differencing operation to generate the difference matrix, which compares the target segment with its reference objects for self-comparison implementation. To effectively extract semantics from the difference matrix, we design difference matrix encoder based on convolutional neural network (CNN) blocks to obtain the final representation of the detection segment. Our primary contributions are listed as follows:
We investigate the problem subject-inddeendent ASD based on the iEEG. Through comprehensive analysis, we identify the self-comparison mechanism as simple yet effective way to capture the general representation.
We propose novel model named DMNet for subject-independent ASD. The fully differenc- ing operation based on contextual reference and channel-level reference for self-comparise can mitigate the local and global biases among subjects and channels, improving the gener- alizability of learned representations.
Extensive experiments on clinical and public iEEG datasets show DMNer outperforms existing SOTAs. Moreover, the generated difference matrix effectively captures seizure activity changes during the seizure evolution process. Furthermore, DMNer outperforms existing SOTAs while maintaining the high efficiency. Building these strengths, deploy our method in an online system, enhancing clinical applications by assisting medical professionals in the diagnosis of epilepsy and by facilitating the provision of more effective treatment options for patients.
2 Problem Formulation
In this work, the iEEG recording is regarded as a set of time series = (xx(1) ME where C' refers the total number of channels. Each (+) E R corresponds to a channel, and 7 refers to the total timestamp. We sequentially test the channels one after another. Specifically, given one channel of iEEG time series (i) {a((). 2.(()) } from subject, first divide the original recording data into segments for detection. For simplicity, we omit the channel index i in subsequent steps:
{su, $1, ..., 8m-1)
where 8k = {xrxk*1," ,Ex((++))) < k S m - 1, is the number of timestamp for each
segment, m is the total number of segments. Each segment 5% has a corresponding label yk E {0, 1}. indicating whether the segment contains a seizure event. In this work, our aim is to predict y% each segment Sy for different subjects.
We define our problem as an innovative study of Domain Generalization (DG) 45 in the context of epileptic diagnosis. In this study, we treat each subject's data as a domain, and our goal is to utilize the data of available labeled subjects (source domains) to train model that can be directly adopted to the subjects with unseen data (target domains).
3 Empirical Analysis
In this section, we first analyze the primary cause behind the failure of existing models for subject- independent seizure detection of the iEEG and the reasons of occurrence. Then we explore the possibility of a domain-consisten seizure pattern existing within iEEG data, taking into account the
3

---

domain shift issue. Finally, we validate whether self- compariso mechanism can mitigate distribution shifts in iEEG data and capture the potential domain consistent seizure patterns.
Sufjects
Overall Distibution
Diaritution Time Inservals and Sobyects afer
Row (KEO Dats
IEE ufeer SC
A Croun Sosbbigg
Cross SrassSuttngg 1000000
Dendty
Natral
Desile
Nerel
O1
RT
0/
Time
Cruw Time
IEEG Data after Self Compariao (SC)
Figure 2: Observation results of the clinical iEEG dataset. (a) Overall distribution of raw iEEG signals (all subjects and channels), where normal and seizure events are indistinguishable. (b) Distribution of raw iEEG signals across different time intervals and subjects, where substantial domain shifts evident in both distinet time intervals and among different subjects (red dashed line at serves as reference line for domain shift). (c) Overall distribution of raw iEEG data after the self-com self-comparison process. (d) Distribution of raw iEEG data across different time intervals and subjects after the relf-comparison process. The self-comparison mechanism effectively mitigates distribution shifts across time intervals and subjects, thus enhancing the model's ability distinguish between seizure and normal events.
3.1 iEEG Domain Shift Issue and Domain Consistent Seizure Pattern
Most previous studies [00 16 assert that vanilla detection models trained independently by each subject are prone to failure when applied to other subjects. To analyze the direct cause of failure, we merge raw iEEG signals from all subjects and channels a clinical iEEG dataset (details in App C.. and analyze the distributions of seizure and normal events. As depicted in Fig. (a), the results reveal nearly identical means and close variances for both seizure and normal signals in the merged data. This similarity leads to the indistinguishability between normal and seizure signals across subjects, which becomes a direct factor to the failure of subject-dependen models.
For detailed analysis, we partition the iEEG signals into multiple intervals, each comprising 250 timestamps, for each subject. We then compute the distributions of seizure and normal events within each interval. Through empirical analysis, observe significant domain shifts both across different subjects (inter-subject) and different time intervals for the same subject (intra-subject). Fig. 2 (b) presents the normal and seizure distributions within four intervals randomly sampled from subjects PI and P2, where the distribution patterns of normal and seizure exhibit substantial variation across different time intervals and subjects. This observation aligns with findings from previous studies in neural science and medicine, which have consistently reported that brain signals exhibit high variability between subjects and sessions due to inherent background neural activities patterns 14), electrode locations [9]. etc.
33 seizure
Despite the pronounced domain shift observed in iEEG signals across subjects and time intervals, there is a notable commonality among subjects. Specifically, seizure events consistently demonstrate higher average amplitude in the frequency domain compared to their background signal (adjacent normal events), indicating more intense neural oscillatory activities. This finding is consistent with previous studies in the field 34 21
3.2 Self- Coll-Comparison can Help
Based on the commonality above, we propose a novel self-comparison mechanism, which compares the target segment with its adjacent normal segment, to mitigate domain shifts between subjects and time intervals. To verify the effectiveness of this mechanism, we conduct an empirical study. First, for each subject, we partition the contiguous iEEG data into small segments. Considering that the spectral signal of brain data can effectively track transient changes before and during seizures (6], we proceed to transform these segments into the frequency domain using Discrete Fourier Transform (DFT). Subsequently, we calculate the spectrum differences by subtracting the spectrum of the target segment from those of adjacent segments on both sides of the target segment. We then sum up the absolute values of these differences, generating single value D for each target segment.

---

Intracranial BEG
Difference Matris ds
Difference Matrix Encoder
Classifirr
DFT
300
0 Conn2d (Gog) D-d)
Detection Result:
X
Normatcation
O indanceloomss
RaLü
MaxFool2d 2xx2)
Avaraage Pooling(txt
Life) in
Radba)
Flatann
Normal V
"Soziree
Figure 3: Overview of the proposed DMNet.
The overall distributions of D values for all seizure and normal segments are depicted in Figure (c). Notably, the distribution of the normal and seizure segments becomes distinctly separated after the adoption of the self-comparison mechanism. Additionally, we analyze the distribution D values for target segments within the same four intervals from PI and P2, which is discussed in Section 3.1 The results are shown in Figure (d). is evident that the distribution of normal or seizures segments is well aligned across different subjects and time intervals, and the patterns of normal and seizure become more distinguishable. These results signify that our proposed self comparinarionnn mechanism effectively mitigates the domain shift issue and preserves domain consistent and distinguishable representation for normal and seizure segments.
Methodology
Inspired by the above observations, we propose called DMNet, which leverages self-comparison to alleviate the distribution shift and preserve the domain consistency while distinguishing seizure patterns.
seizure detection framework
Overview. The overall framework is illustrated in Fig. 3 First, for each detection segment 8 we
construct two reference segments (contextual reference (s (sxss), channel-level reference (sk) / /R (&z))))) 3) to compare with the target segment (Fig. 3 left). Then we use a simple yet effective fully differencing operation with signed-min-max normalization for self-comparison implementation, and the compared information is encoded by a difference matrix (DM) (Fig. 3 middle). Then we employ CNN-based difference matrix encoder to learn the latent representation of DM, and use a classifier for seizure detection (Fig, 3 right).
4.1 References for Self-Comparison
Contextual Reference. The structural and functional differences in brain neural activity lead to distribution shifts between subjects, and even across different time intervals within the same subject. Based on the insights from observation studies in Section 3.2 we propose to compare the seizure wave with its adjacent contexts for the identification of seizure activities, as it significantly mitigates the domain shifts between subjects and preserves a Nomain-consisten and distinguishable pattern of seizure events.
However, capturing the long dependencies between seizure events and their contexts is challenging with a single contextual segment. This is because a typical epileptic seizure phase consists pre- seizure aura, seizure onset, and post-seizure periods, with varying duration (ranging from seconds to minutes or longer in the case of status epilepticus) 12]. To this end, we first extract 2 x N temporal segments {s:) k-
NSisk-1 ( and { + from both sides of 8 (each contains T. N x & timestamps in total, with each segment consisting of ( timestamps), ensuring that the context contain abundant normal information for comparison. Subsequently, we apply DFT convert these segments into the frequency domain representation E I Finally, the frequency domain segments obtained from the left and right sides are referred the contextual references of 5g. denoted Le(sk) N respectively.
and (sk) E R
Channel-level Reference. Different physiological brain regions have variations in neural activi- ties (37). leading to distribution shifts between channels, even within the same subject. Although
5

---

contextual reference can reduce local bias, it fails to address global bias. Moreover, for prolonged epileptic seizures, solely considering the adjacent contextual reference segments may not provide sufficient normal information as background for comparison. To address these issues, we introduce channel-level reference as representative features of channels. The aim to personalize channels, alleviate global bias, and provide comprehensive global background information of normal events.
Specifically, we adopt the K-Means [44] algorithm to identify the most representative patterns within a channel. First, we divide the entire time series of each channel into segments with length e. Then, similar with contextual reference, we use DFT obtain the frequency domain representation R of all segments. Next, the K-Means clustering algorithm is applied to group all frequency domain representations into K clusters. Finally, we arrange the clusters in descending order according the number of elements they contain (denoted as C₁, C22 The arrangement indicates that the higher the index of the cluster, the lower the frequency of occurrence of the corresponding general pattern in the respective channel.
CK. where |C] 2 |C2] 2 ... 2 |Cxl) D.
To obtain the general patterns of the channel, we use the centroid of each cluster, resulting in the final representation denoted as μak E IRd, k = 1,,., K. These p4 values are then concatenated to construct the left side channel-level reference Loe(ss) E Rxxd, xd, Empirically, the right side Rot (5x) is formed by reversing the order of (8x).
4.2 Difference Matrix
In this subsection, we present the self-comparison implementation based on the constructed references and target segments through simple yet effective approach of fully differencing operation. The comparison information is encoded using difference matrix (DM).
We first obtain the frequency domain representation o concatenate 2 with the constructed contextual and channel-level references to form the augmented segment of (as shown in Figure 3
of target segment 8) via DFT, and then
bottom-lefi):
(o) [[<)ll of [[Ro(s))]l Rer(sR), /
where || is concatenate operation and o 1(2N+2K+1)dd
Fully Differencing Operation. To implement self-comparison of target segment and references, we introduce fully differencing operation. Unlike traditional first-order differencing [3] that considers only adjacent points, the fully differencing operation makes pairwise comparison across all segments i (described in Equation 3 and Fig. 3 middle), which can more effectively capture the essential seizure patterns of brain activities. Moreover, since there are inherent scale differences in the vanilla difference matrix D caused by varying magnitudes between seizure and normal iEEG signals across subjects, channels and time intervals, min-max normalization is adopted to address the scale difference issue. After these two operations, synthetic difference matrix g can be obtained:
Da(i..] = a{11 - *(b1, < i,j S 2N + 2K +1,
D₂ Min-Max-Norm(D))
The generated difference matrix D& contains rich semantic information about the evolution of seizures. We provide more detailed discussion each component of the difference matrix D₃ and the corresponding semantic properties App B
Difference Matrix Encoder. To well capture and learn these essential differences, we adopt the CNNs as the DM encoder (Fig. 3 right), which have been proven be powerful in learning representations from 2D matrices 35 The output the CNNs will be concatenated as a representation 2 of the DM. Finally, 2 will be fed into a linear classifier to obtain the detection result.
Experiments
In this section, we conduct extensive experiments on public and clinical iEEG datasets to address three primary research questions: RQ1. How does the proposed DMNer model perform subject- independent seizure detection compared to other methods? RQ2. Do the proposed contextual

---

Table 1: Average performance of subject-independen seizure detection tasks on clinical & public datasets. The indicates the first rank in a column and y indicates the second. The performance with standard deviation is given in App. G
Dataset
Clinical
MAYO
FNUSA
Model
Pre.
Rec.
F1
Rec.
Rec.
SelfReg
$1.60
48.74
51.24
48.63
60.40
32.13
36.13
32.12
62.54
48.19
49.20
47.73
GroupDRO
47.60
44.74
45.15
46.33
48.31
35.00
27.82
28.04
53.48
71.44
60.47
66.38
MTL
20.46
52.33
28.59
39.13
46.87
22.08
15.68
60.04
52.64
$2.83
CORAL
38.70
49.20
42.01
47.66
62.17
29.86
20.41
22.01
65.13
53.23
55.93
53,88
CDANN
33.43
40.41
35.72
37.58
36.79
79.55
45.49
56.60
64.37
54.85
54.35
53.86
SD
18.69
54.40
28.78
40.81
47.73
55,59
46.97
50.35
56,99
57.97
55.42
56.45
IB-IRM
29.19
49.75
37.91
42.64
47.57
57.17
46.86
50.71
54.22
63.26
55.96
59.47
VREx
44.80
32.45
36.33
35.34
51.21
59.95
51.19
54.85
54.74
60.15
54.64
57.12
IB-ERM
40.30
37.40
37.59
37.19
46.29
57.36
47.21
51.44
54.64
55.26
52.68
53.70
TRM
34.03
42.74
38.93
41.58
47.55
58.97
43,96
47.87
58.46
Abou-Abbas et al.
43.24
45.84
43.15
46.95
48.47
51.40
50.69
48.86
49.83
56.90
52.33
57.53
Zhao et al.
30.17
49.44
36.16
42.65
37.07
56.06
26.17
38.48
41.64
44.20
40.62
42.12
Dissanayake et
40.12
39.29
38.30
50.39
68.99
$7.69
63.85
76.01
63.75
67.94
SICR
46.27
43.91
45.65
43.86
79.01
63.29
69.88
66.17
63.78
66.77
64.25
65.10
SEEGNet
44.89
47.70
46.25
47.11
71.82
60.50
64.87
63.15
62.23
72.35
66.81
68.12
PPi
51.72
49.70
49.78
51.12
74.49
70.21
72.28
71.02
59.53
75.42
65.83
71.59
DMNet
59.58
55.24
54.49
55,93
68.82
90.06
73.08
81.54
62.30
85.39
67.80
75.15
DMNet w/o Leee
48.25
53.30
49.62
51.20
47.10
89.15
62.63
76.43
52.57
78.49
60.99
70.75
DMNet w/o L.
51.39
47.43
47.32
47.15
58.34
76.73
64.28
71.79
49.28
73.48
58.12
65.23
DMNet w/o DM
43.58
45.79
46.72
43.42
49.67
71.54
60.63
66.57
46.98
66.89
56.21
62.18
reference, channel-level reference and difference matrix contribute to seizure detection? RQ3, How does the difference matrix reflect seizure activity changes during seizure evolution process?
5.1 Experimental Setup
To evaluate the performance of our DMNet model, we conduct experiments both the public benchmark dataset, which includes MAYO and FNUSA [25], and the private clinical dataset (details refer to App.C).
Datasets.
Evaluation Metries. For fair comparison, we use precision, recall, F1-score and F2-score as evaluation metrics. Typically, F2-score is particularly emphasized in practical clinical studies [15 43 since overlooking any seizure can be costly terms of diagnosis. Therefore, our study, the F2-score serves the primary metric for comparison.
Settings. To conduct the experiment under the domain generalization settings, we divide the subjects in the datasets into multiple groups and assign different groups source and target domains for model training, validation and testing. A more detailed description of experimental setup that includes
DMNer hyperparameters and setup on clinical and public datasets, can be found in App. D
Baselines. We compare the proposed DMNet with state-of-the-art subject-independent seizure detec- tion algorithms for both iEEG-based methods and BEG-based methods. For iEFGG-baed methods, we compared against SICR [17), SEEG-Net (39] and PPi [4]]. For EEG-based methods, we compared against Abou-Abbas et al. (2). Zhao et al. 44 and Dissanayake et al. (II]. Additionally, we
compare the performance with the domain generalization (DG) algorithms in other areas like Self-
Reg [18), GroupDRO [32] MTL [7]. CORAL (36), CDANN 12) SD (88, IB-IRM B. VREx [19
IB-ERM TRM 40 More details of the baselines are shown in App.
5.2 Overall Performance Comparison (RQ1)
The overall performance of our proposed model DMNet and other baselines for subject-independent seizure detection are presented in Tab. From the results, we can see that our proposed DMNer significantly outperforms other SOTA subject-independent seizure detection algorithms and the latest domain generalization methods, with an average improvement of 9.41%. 14.81% 81% and 4.97% in terms of score on clinical and public datasets (MAYO and FNUSA) respectively. These results highlight the superior generalization ability of DMNet. Compared to DG basclines, our model exhibits
7

---

substantial margin in all evaluation metrics, suggesting that general DG baselines fail to capture the diverse and evolving distribution patterns iEEG over time. Furthermore, the EEG-based methods proposed by (2]. 44 and [ may not be adept at handling complex iEEG signals, which lead to subpar performance. Although the iEEG-based methods [11] SEEG-Net [39] and SICR [17] outperform most EEG-based methods and DG methods on F2-score, they still fall short of the performance compared to our model. This may be attributed to the fact that they do not explicitly capture the general pattern of difference between normal and seizure signals. In contrast, we utilize difference matrix to achieve a distinguishable representation of normal and seizure.
5.3 Ablation Study of DMNet (RQ2)
To validate the contribution of cach component of our proposed DMNet, we conduct ablation studies on key components (w/o means without and w/ means with). The results of the ablation evaluation can be seen in Tab. | from which we can see full DMNet significantly outperforms other ablated models on F2-score. These results of the ablation experiment highlight the effectiveness of the following components:
Channel-level Reference. Removing channel-level reference causes poorer results compared the full version. It indicates that utilizing the channel-level reference with representative characteristics of each channel for global dependencies modeling can improve the performance.
Contextual Reference. Removing contextual reference results in noticeable performance drop. It illustrates that introducing the informative contextual reference for self-comparison capture long-term dependencies and complete patterns seizure improves the performances.
Difference Matrix. Removing DM leads to significant drop in model performance, indicating the effectiveness a fully differencing operation for the implementation self-comparison.
5.4 Case Study (RQ3)
Nn mmmma
wly
(b)
(c)
(d)
(c)
(g)
Figure 4: Case study.
To provide more intuitive demonstration of DMNet, present the visualization results of difference matrix throughout the seizure process in Fig. (A full visualization can be found in App. E}. The upper figure shows the raw brain signal containing full seizure process, with the gray wave representing the normal signal and the purple wave representing the scizure. The green masked blocks indicate the segments for detection. Notably, there are clear distinctions between seizure and normal difference matrices during the seizure evolution. Segments being closer to seizure events show rougher difference matrices (e.g., segments d, and e), while those further away appear smoother (e.g., segments a, b, f, and g). This case clearly illustrates how the difference matrix captures seizure activity changes and demonstrates the effectiveness of DMNet.
5.5 Hyperparameters Analysis of DMNet
Number of Segments N. As described Sec. 4.1 we utilize 2 x N segments to form the contextual reference. Increasing the value of N results in longer contextual reference, indicating the inclusion of greater amount of contextual information. As depicted in Fig. 5 a). the evaluation scores generally increase N increases from 8 to 12. This trend is attributed to the fact that longer contextual reference can provide more comprehensive information throughout the entire seizure phase.
Segment Length L. We investigate the effects of segment length by varying the segment length of contextual reference. The performance of DMNer with different segment lengths (100, 150, 200, 250, 300) is shown in Fig. 5(b). As increases, the model precision decreases.

---

Toditt -e- Beed
.KINI THI SM
Fl-ccoe
54
9 1980
191
259 Length of Segment
299
390
II
14)
Number of Segments
Number of Clusters
Inference Time (s/subject)
(b)
(c)
Figure 5: Hyperparameters Anslysis: (a. b. c) and Computational Efficiency Analysis (d).
In contrast, recall, Fl score and F2-score initially increase when é ranges from 100 to 200 but then decline. This suggests that shorter segment lengths (E) fail to provide representative semantic infor- mation, preventing the model from capturing long-term dependencies in the brain signal. Conversely, excessively long segment lengths can result in coarse-grained temporal representations, leading to the loss of fine-grained patterns and details.
Number of Clusters K. We vary the number of clusters in channel-level reference, which controls the number of generated channel representative features of specific channel. As we see in Fig. 5ic), the evaluation metrics (recall, F1 score, and F2-score) demonstrate an initial increase followed by decrease trend as K varies from 6 to 12. However, precision shows upward trend. This indicates that introducing global information can reduce false positive samples but also affects recall. Therefore, it is necessary to consider trade-offt when selecting the value of K.
5.6 Generalization Ability Analysis
To further assess the generalization capability of DMNet on broader range of subjects with greater heterogeneity, we evaluated the model on data of 179 previously unseen subjects from the large TUSZ EEG dataset [ Additional details about this evaluation study are provided in App
5.7 Application Scenario
Model Efficiency. We compare the model efficiency of DMNet and several benchmark models in terms of parameter count and average inference time per patient file. As shown in Fig. (d), the parameter count of DMNet is only 19.4% of the model with the smallest parameter count, but its performance is 109.4% of the best-performing model. Additionally. DMNer has an average inference time of 45.5 seconds per subject file, which also the fastest among all models. Overall, DMNet demonstrates significant advantages in both parameter count and inference time. Therefore, DMNet an ideal choice, providing reliable and gegh-performanc solution for real application scenario.
Online Deployment. DMNer has been deployed on online system () which illustrates the effectiveness of our method in real clinical ap- auxiliary
plication. This system serves tool for expert doctors, significantly enhancing the accuracy and efficiency of the diagnostic process. The system comprises two important pages: the overview page and the detail page. The overview page (top) offers a compre- hensive view of the 12-hour patient file. Each square on the page represents a I-minute iEEG signal segment and is color coded indicate var- ious states, including no epileptic waves (gray), correct predictions (green), incorrect predictions (blue), and missing predictions (red) made by our model. By clicking on square, doctors can access the detail page (Fig/6) (bottom)), where they can change presented time period using
Figure 6: Online auxiliary diagnosis system.
the top toolbar. The page includes data operation panel and scizure events displayed on the right

---

side. In the center of the page, the purple section represents the true seizure annotations provided by doctors, while the yellow section showeases our model's 's predictions. As depicted in the figure, the predictions of our model align well with the actual seizures.
6 Related Work
Epileptic Seizure Detection for EEG. Data-driven methods for seizure detection have gained attention in clinical medicine. [38] combine CNN and SVM, B1] leverage frequency components and CNN. However, these methods are subject-specific and not suitable for real-world application. Several efforts have been made in the study of aubject-independent methods in EEG. [ proposed and investigates a subject-independens seizure detection model that uses stable EEG-based features obtained by comparing multiple feature selection methods. 44 proposed two subject independent deep learning architectures with different learning strategies that can learn a global function utilizing data from multiple subjects. [1I] proposed IBA (Information Bottleneck Attribution), a subject- independent seizure detection model that utilizes multi-view information. It employs adversarial deep learning to learn seizure-spp -spcuriies feature representations directly from raw EEG data, However, these methods are based on non-invasive EEG recordings.
Epileptic Seizure Detection for iEEG. iEEG, through the placement of electrodes inside on the surface of the brain, offers higher temporal and spatial resolution, enabling more accurate capture and analysis of brain activity in specific regions, including subtle changes in electrophysiolggcaal signals. Consequently, this has spurred research into epilepsy detection based on iEEG [26]. There several seizure detection methods being designed in subject-independen settings, which are more applicable to real-world scenarios. SEEG-Net (39] and SICR (17) proposed adversarial training to learn subject-invariant features iEEG recordings. However, their experiments were carried out on small, manually denoised datasets with a balanced positive-negative sample ratio, resulting in a significant data bias that deviates from real clinical requirements. Moreover, [41) proposed method that utilizes series of intricate pre-training strategies to learn general pattern cross subjects, which is lack of efficiency.
General Domain Generalization. Our work focuses on detecting seizure events in unseen subjects, which can be framed as the domain generalization (DG) problem 445). Existing DG studies can
be categorized into two groups: Invariant representation based method [3 22
and Invariant representation methods aim learn
I
3
7
Learning strategy bused method (00 32
19
28).
domain-invariant representations. CORAL 36 aligns covariance in feature layers, enhancing the introduces adversarial training to encourage robust and domain- invariant feature learning. IB-ERM [4] minimizes empirical risk across domains to improve generalization. SelfReg [18] uses self-supervised learning and contrastive loss to capture invariant information across domains. Learning strategy methods aim to enhance generalization capability through various learning strategies. GroupDRO [2] achieves higher worst-group accuracy by coupling robust optimization models with increased regularization. VREx [19] penalizes the variance of training risks to improve domain extrapolation. Despite prior efforts, DG problems in time series, like iEEG signals, continue to be relatively unexplored area and poses considerable challenges due to the diverse and evolving distribution patterns with time.
extraction of domain-invariant features. CDANN [22
Conclusion
In this paper, present novel seizure detection framework called DMNet. Our model addresses the challenge of generalization across different subjects by incorporating a self-comparison mechanism to capture the nubject-invariant representation. Extensive experiments conducted clinical intracranial EEG dataset and public dataset demonstrate the effectiveness of our model in subject-independen seizure detection tasks. Moreover, our generated difference matrix effectively captures seizure activity changes during the seizure evolution process, which is valuable for clinicians to better understand the seizure event and develop more effective treatment, Furthermore, DMNer outperforms existing SOTAS while maintaining the high efficiency. Based on these, we deploy our method in an online system, enhancing clinical applications by assisting physicians in the diagnosis of epilepsy and in offering optimal treatment strategies. We hope that this work will shed light on the development of a more robust aubject-indepence seizure detection system.
10

---

Acknowledgments
This work was partially supported by National Natural Science Foundation of China (No. 62322606,
No. 62441605).
References
[1] The temple university hospital seizure detection corpus. Frontiers in Neuroinformatiis, page 83, 2018.
[2] Lina Abou-Abbas, Khadidja Henni, Imene Jemal, Amar Mitiche, and Neila Mezghani. Patient- independent epileptic seizure detection by stable feature selection. Expert Systems with Appli- cations, 132:120585, December 2023.
[3] Kartik Ahuja, Ethan Caballero, Dinghuai Zhang, Jean Chaishhiitt Gagnon-Auder Yoshua Bengio, Ioannis Mitliagkas, and Irina Rish. Invariance Principle Meets Information Bottleneck for Out-of Diitr--Dittiibtiion Generalization. In Advances in Neural Information Processing Systems, volume 34, pages 3438-3450, 2021.
[4] Kartik Ahuja, Ethan Caballero, Dinghuai Zhang, lean-Christophe Gagnon-Audet, Yoshua Bengio, loannis Mitliagkas, and Irina Rish. Invariance principle meets information bottleneck for
generalization. Advances in Neural Information Processing Systems,
2021.
[5] Abdu Soha Alomar, Jaes Jones, Andres Maldonado, and Jorge Gonvalez-Martinez, The stereo- eleetroencephaalorrahy methodology. Neurosurgery Clinics of North America, pages 83-95, 2016.
[6] Mojtaba Bandarabadi, César A Teixeira, Jalil Rasekhi, and António Dourado. Epileptic seizure prediction using relative spectral power features. Clinical Neurophysiology, 126(2):237-2488 2015.
[7] Gilles Blanchard and Aniket Anand Deshmukh. Domain Generalization by Marginal Transfer Learning.
[8] Gilles Blanchard, Aniket Anand Deshmukh, Urun Dogan, Gyemin Lee, and Clayton Scott. Domain generalization by marginal transfer learning. Journal of Machine Learning Research, pages 1-55, 2021.
[9] Stephan Chabardes, Taylor J Abel, Francesco Cardinale, and Philippe Kahane. Commentary: understanding strroeleetnennellallggayyy what's next? Neurosurgery, pages E15-E16. 2018.
[10] Xin Chai, Qisong Wang, Yongping Zhao, Xin Liu, Ou Bai, and Yongqiang Li. Unsupervised domain adaptation techniques based on auto-encoder for non-stationary eeg-based emotion recognition. Computers in biology and medicine, 79:205-214, 2016.
[11] Theckshana Dissanayake, Tharindu Fernando, Simon Denman, Sridha Sridharan, and Clinton Fookes. Deep Learning for Patient- Independed Epileptic Seizure Prediction Using Scalp EEG Signals. IEEE Sensors Journal, 21(7):9377-9388 April 2021.
[12] Arjan Hillebrand. Niall Holmes, Ndedi Sijsma, George C. O'Neill, Tim M. Tiemney, Niels Liberton. Anine H. Stam. Nicole van Klink, Coreelis J. Stam, Richard Bowtell. Matthew J. Brookes, and Gareth R. Barnes. Non-invasive measurements of ictal and interictal epileptiform activity using optically pumped magnetometers. Scientific Reports, 2023.
[13] S. L.. Ho and M. Xie. The of ARIMA models for reliability forecasting and analysis. Computers Industrial Engineering, 1998.
[14] M Shamim Hossain, Syed Umar Amin, Mansour Alsulaiman, and Ghulam Muhammad. Ap- plying deep learning for epilepsy seizure detection and brain mapping visualization. ACM Transactions on Multimedia Computing, Communications, and Applications, pages 1-17, 2019.

---

[15] Yingying Hu, Ruijia Chen, Haibing Gao, Haitao Lin, Jinye Wang. Xiaowei Wang, Jingfeng Liu, and Yongyi Zeng. Explainable machine learning model for predicting spontaneous bacterial peritonitis in cirrhotic patients with ascites. Scientific Reports, 2021.
[16] Eunjin Jeon, Wonjun Ko, and Heung-Il I1 Suk. Domain adaptation with source selection for motor-imagery based bei. In 2019 7th International Winter Conference on Brain- Crain-Computer Interface (BCI), 2019.
[17] Eunjin Jeon, Wonjun Ko, Jee Scok Yoon, and Heung-Il Suk. Mutual information-driven subject- invariant and class-relevant deep representation learning in bci. IEEE Transactions on Neural Networks and Learning Systems, 2021.
[18] Dachee Kim, Youngjun Yoo, Seunghyun Park, Jinkyu Kim, and Jackoo Lee. Selfreg: Self- supervised contrastive regularization for domain generalization. In Proceedings of the Interna- tional Conference on Computer Vision, pages
2021.
[19] David Krueger, Ethan Caballero, Joem-Henrik Jacobsen, Amy Zhang, Jonathan Binas, Dinghuai Zhang, Remi Le Priol, and Aaron Courville. Out-of-distribution generalization via risk extrapo- lation (rex). In International Conference on Machine Learning. PMLR, 2021.
[20] Da Li, Yongxin Yang, Yi-Zhe Song, and Timothy Hospedales. Learning to generalize: Meta- learning for domain generalization. In Proceedings of the AAAI conference on artificial intelligence, 2018.
[21] Guangye Li, Shize Jiang, Sivylla E Paraskevopoulou, Meng Wang, Yang Xu, Zehan Wu, Liang Chen, Dingguo Zhang, and Gerwin Schalk. Optimal referencing for stereo- electreencephalograpiicc (seeg) recordings. Neurolmage, pages 327-335, 2018.
[22] Ya Li, Xinmei Tian, Mingming Gong, Yajing Liu, Tongliang Liu, Kun Zhang, and Dacheng Tao. Deep domain generalization via conditional invariant adversarial networks. In Proceedings of the European Conference on Computer Vision, pages 624-639, 2018.
[23] Hong Liu, Mingsheng Long, Jianmin Wang, and Michael Jordan. Transferable Adversarial Training: A General Approach Adapting Deep Classifiers. In Proceedings of the 36th International Conference on Machine Learning. PMLR, 2019.
[24] S. Lloyd. Least squares quantization in pem. IEEE Transactions on Information Theory, 28(2):129-133 137, 1982.
[25] Petr Nejedly, Vaclav Kremen, Vladimir Sladky, Jan Cimbalnik, Petr Klimes, Filip Plesinger, Filip Mivalt, Vojtech Travnicek, Ivo Viscor, Martin Pail, Josef Halamek, Benjamin H. Brinkmann, Milan Brazdil, Pavel Jurak, and Gregory Worrell. Multicenter intracranial EEG dataset for classification of graphoelements and artifactual signals. Scientific Data, 7(1):179, June 2020.
[26] Min Ni. Bushra Afroze, Chao Xing, Chunxiao Pan, Yanqiu Shao, Ling Cai, Brandi L Cantarel, Jimin Pei, Nick V Grishin, Stacy Hewson, et al. A pathogenic ufsp2 variant in an autosomal recessive form of pediatric neurodevelopmental anomalies and epilepsy. Genetics in Medicine, pages 1-9, 2021.
[27] Xingchao Peng, Zijun Huang, Ximeng Sun, and Kate Saenko. Domain Agnostic Learning with Disentangled Representations. In Proceedings of the 36th International Conference on Machine Learning. PMLR, 2019.
[28] Mohammad Pezeshki, Oumar Kaba, Yoshua Bengio, Aaron C Courville, Doina Precup, and Guillaume Lajoie. Gradient Starvation: A Learning Proclivity in Neural Networks. In Advances in Neural Information Processing Systems, volume 34, pages 1256-1274 2021.
[29] Mohammad Pezeshki, Sékou-Oumar Kaba, Yoshua Bengio, Aaron Courville, Doina Precup, and Guillaume Lajoie. Gradient starvation: A learning proclivity neural networks. arXiv e-prints, pages arXiv-2011, 2, 2020.
12

---

[30] Timothée Proix, Viktor K. Jirsa, Fabrice Bartolomei, Maxime Guye, and Wilson Truccolo. Predicting the spatiotemporal diversity of seizure propagation and termination in human focal epilepsy. Nature Communications, 91)::1088, March 2018.
[31] Md Bashed-Al-Mahhee Mohammad Ali Moni, Shahadat Uddin, Salem A Alyami, Matthew A Summers, and Valsamma Eapen. A deep convolutional neural network method to detect seizures and characteristic frequencies using epileptic electroemceepallogam (eeg) data. IEEE Journal of Translational Engineering in Health and Medicine, 2021.
[32] Shiori Sagawa, Pang Wei Koh, Tatsunori B Hashimoto, and Percy Liang. Distributionally robust neural networks for group shifts: On the importance of regularization for worst-case generalization. arXiv preprint arXiv: 191 1.08731, 2019.
[33] Wojciech Samek, Frank C Meinecke, and Klaus-Robert Müller. Transferring subspaces between subjects in arain-computer interfacing. IEEE Transactions on Biomedical Engineering, pages 2289 2298, 2013.
[34] Catherine A Schevon, Shennan A Weiss, Guy McKhann Jr. Robert R Goodman, Rafael Yuste, Ronald G Emerson, and Andrew J Trevelyan. Evidence of an inhibitory restraint of seizure activity in humans. Nature communications,, 2012.
[35] Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep Inside Convolutional Networks: Visualising Image Classification Models and Saliency Maps, 2014.
[36] Baochen Sun and Kate Saenko. Deep coral: Correlation alignment for deep domain adaptation. In Computer Vision ECCV 2016 Workshops. Springer, 2016
[37] James X. Tao, Shasha Wu, Maureen Lacy, Sandra Rose, Naoum P. Issa, Carina W. Yang. Katherine E. Dorociak, Maria Bruzzone, Jisoon Kim, Ahmad Daif, Jason Choi, Vernon L. Towle, and Peter C. Warnke. Stereotactic EEG-guided laser interstitial thermal therapy for mesial temporal lobe epilepsy. Journal of Neurology, Neurosurgery, and Psychiatry, 2018.
[38] Syed Muhammad Usman, Shehzad Khalid, and Muhammad Haseeb Aslam. Epileptic seizures prediction using deep learning techniques. IEEE Access, pages 39998 40007, 2020.
[39] Yiping Wang, Yanfeng Yang. Gongpeng Cao, Jinjie Guo, Penghu Wei, Tao Feng. Yang Dai, Jinguo Huang, Guixia Kang, and Guoguang Zhao. Seeg-net: An explainable and deep learning- based cross-subject pathological activity detection method for drug-resistant epilepsy. Comput- ers in Biology and Medicine, page 105703, 2022.
[40] Yilun Xu and Tommi Jaakkola. Learning representations that support robust transfer of predic- tors. arXiv e-prints, pages ar 2021.
[41] Zhizhang Yuan, Daoze Zhang, Yang Yang, Junru Chen, and Yafeng Li. PPi: Pretraining brain signal model for patient-independen seizure detection. In Thirty- Conference on Neural Information Processing Systems, 2023.
[42] Matthew D. Zeiler and Rob Fergus. Visualizing and Understanding Convolutional Networks. In Computer Vision - ECCV 20/4. Springer International Publishing, 2014.
[43] Kevin Zhang and Dina Demner-Fushman. Automated classification of eligibility criteria in clinical trials to facilitate patient-trial matching for specific patient populations. Journal of the American Medical Informatics Association JAMIA, 2017.
[44] Yanna Zhao, Gaobo Zhang, Yongfeng Zhang, Tiantian Xiao, Ziwei Wang, Fangzhou Xu, and Yuanjie Zheng. Multi-view cross-subject seizure detection with information bottleneck attribution. J. Neural Eng., 19(4)004601,, August 2022.
[45] Kaiyang Zhou, Ziwei Liu, Yu Qiao. Tao Xiang, and Chen Change Loy. Domain Generalization: A Survey. JEEE Transactions on Pattern Analysis and Machine Intelligence, 2022.
13

---

A Baselines
Firstly, we compare our model to other BGEG-based subject-independens epilepsy detection models. The Details of these baseline models are given here:
framework that learns class-relevant and subject- invariant feature representa- tions, which shows a promising performance in non-invasive wrain-computer interface.
SICR 17
model that can address the problems of sample imbalance, cross-subject domain shift, and poor interpretability and realizes high-sensitivity SEEG pathological activity detection. The source code of SEEG-Net is not released, so we implement it by ourselves to conduct the experiments.
SEEG-Net [39
proposed method that utilizes series of pre-training strategies extract rich information from iEEG data while preserving the unique characteristics between brain signals recorded from different brain areas.
PPi [39]
Secondly, we also compare our model to several EEG-hased subject-independent epilepsy detection models. The Details of these baseline models given here:
2 they propose and investigates a stable EEG-based features obtained by comparing multiple feature selection methods.
seizure detection model that uses
44]] they propose two subject independent deep learning architectures with different learning strategies that can learn a global function utilizing data from multiple subjects.
11 they propose a subject-independen seizure detection model, called IBA (Information Bottleneck Attribution), that utilizes multi-view information. By employing adversarial deep learning, the model learns seizure-specific feature representations directly from raw EEG data.
Moreover, we offer more details on comparisons to other latest domain generalization methods utilized in this paper:
CDANN 22 an end-to-end conditional invariant deep DG approach by leveraging deep neural networks for domain-invariant representation learning.
CORAL [36]:
unsupervised domain adaptation method that aligns the second-order statistics of the source and target distributions with a linear transformation.
GroupDRO 32 model coupling group DRO models with increased regularization, where DRO allows to learn models that instead minimize the worst-case training loss over a set of groups.
MTL [ a representative framework for DG, which augments the original feature space with the marginal distribution of feature vectors.
regularization method aimed at decoupling feature learning dynamics, improving accuracy and robustness in cases hindered by gradient starvation.
SD 29
regularization method for DG based contrastive learning, self-supervised contrastive regularization.
SelfReg [8]
TRM 40
robust estimation criterion that is specifically geared towards optimizing transfer to new environments.
VREx 19 penalty on the variance of training risks simpler variant based form of robust optimization over perturbation set of extrapolated domains.
IB-ERM DG method that improve generalization via minimizes the empirical risk over multiple domains.
IB-IRM 4 a DG method that improve generalization via minimizes the invariant risk over multiple domains.
14

---

0
Channel-level
2
A
Reference
3
5
0.0
40.2
Difference Matrix
5-
Contextual Reference
0.00
40002
10
10
Normal
Seizure
Figure 7: Visualization of difference matrix.
B Indepth Visualization of Difference Matrix
In this section, we present visualizations the difference matrix (DM) constructed in Section 4.2, for providing an in-depth analysis of the DM properties. Initially, the difference matrix is constructed separately for normal and seizure segments of all subjects using the method mentioned in Section Next, we average all difference matrices of normal and seizure segments obtain the averaged 2-dimensional matrices. These two averaged 2D matrices are shown in the second row of Fig. 7 The green square with dashed line represents the difference between the channel- reference and target segment uf-- A zoom-in visualization provided in the first row of the Fig. The left (normal) shows little difference of æf. with most of the channel patterns (small cluster index), but significant difference with a small portion of channel patterns (large cluster index). Conversely, the right one (seizure) exhibits the opposite pattern, validating the effectiveness of channel-level reference. Furthermore, the red square with the dashed line represents the difference within æ (only containing contextual reference). The third row of the figure presents a zoom-in visualization, showing a smooth 2-dimensional matrix for normal event and rough 2-dimensional matrix for seizure event. This demonstrates the effectiveness of introducing contextual reference.
C
Datasets
To evaluate the performance of our model, we conduct extensive experiments on the following two datasets.
Clinical Dataset. The clinical dataset in our study is provided by a first-class hospital, and the intracranial EEG electrode implantation surgery and data collection are approved by the official ethics committee. For each subject, 4 10 invasive electrodes with 52 126 channels are implanted according to clinical needs to obtain brain signals. The dataset is quite massive due to the high frequency and multiple channels used record intracranial EBG data, with more than 738 recording hours and 877.3GB total size. Data are labeled by professional neurologists point level. Moreover, the positive sample (seizure event) ratio of a single subject in our dataset is around 0.003 on average, which is extremely imbalanced. More details can be found in Table
15

---

Public Dataset. The public dataset MAYO and FNUSA [25] used in our paper, is collected from St. Anne's s University Hospital (Brno, Czech Republic). This dataset composed of intracranial EFG data collected in awake resting state from 38 diagnosed subjects. Specifically, the dataset comprises total of 348,300 segments. Each segment spans duration seconds and consists of 15,000 data points, with sampling frequency of 5000Hz. These segments are labeled into categories, including physiological activity, pathological activity (scizure event), artifacts, and power line noise. We follow the setup in [39] of omitting invalid data from one subject while retaining the data from 30 subjects for analysis. More details can be found in Table
Table 2: Basic hyperparameters of DMNet.
Parameter
Clinical dataset Public dataset
Length of Segment &
250
500
Number Segments N
Number of Clusters K
8
Base Filter Number Cj
64
8
Batch Size
24
24
Optimizer
Adam
Adam
Learning Rate
3 x 10 20
3 x 10
Max Epoch
20
Valid Metric
F1-score
Fl-score
Table 3: Details information of the clinical and public dataset.
Time (hours)
Sample frequency(Hz)
Positive sample ratio
Dataset
Subject ID
#Electmdes
#Channels
#Samples
gender
PO
0.003
8,113.760
male
P1
24
512
0.0002
4,176.200
female
P2
512
5
69
0.004
3,698.920
malc
Clinical
P3
21
1000
4
52
0.004
3,460,280
female
P4
1000
10
126
0.001
9,664.920
female
P5
0.002
3,818,240
female
P6
24
512
0.009
6,801,240
female
P7
36
1024
52
0.001
1,789.800
male
PO
2.2
5000
0
2648
P1
7,9
5000
0. 1020
9536
P2
2.3
5000
2.2231
2788
P3
5000
6693
P4
P5
6.3
5000
0
7585
P6
10.7
5000
0
I 12873
PS
2.3
5000
1
2816
P9
5000
740
P14
5000
6.8795
3924
P16
5000
0
3876
PI7
8.5
5000
0
10194
PI8
4.0
5000
0
4826
P19
4.7
5000
0
5613
P20
P21
2.9
5000
59,1724
3490
P23
3.46
5000
1.96
4152
PO
1.6
5000
1912
PI
10.3
5000
0.1341
12358
P2
6.7
5000
0.9985
8088
P3
7.1
5000
8463
P4
5000
0.1268
12038
ENUSA
P5
2.1
5000
0.6176
2516
P6
13.2
5000
0.4884
15843
P7
18.9
5000
0.0834
22774
P8
5000
PO
5000
0.3675
11591
PIO
8.6
5000
0.3953
10301
PII
39.3
5000
0.1631
47270
P12
16.4
5000
0.2708
19635
16

---

Table 4: Group information of clinical and public datasets.
Group
Dataset
Clinical
0,7
5,6
2,4
1,3
MAYO
0,18,21
1,9,19
2,5,16
3,4,23
6,8
14,17,20
FNUSA
0,4
1,8
2.3.11
5,6
7,9
10,12
Table 5: Detailed information of dataset setup in the experiment.
Dataset
Exp. id
Training
Validation
Test
0
C+D
B
A
1
B+D
C
A
A
2
B+C
D
C+D
A
B
B
4
A+D
C
Clinical
5
A+C
D
B
6
B+D
C
C
7
A+D
CSC DI
C
8
A+B
9
B+C
10
A+C
11
A+B
0
A+B+C+D
BND
F
1
A+B+C+F
ERGAY
P
Public
2
A+B+E+F
3
A+D+E+F
4
C+D+E+F
A
5
B+C+D+E
Experimental Setup
All experiments were a Linux system with CPUs (AMD EPYC 7H12 64-Core Processor) and 4 GPUs (NVIDIA GeForce RTX 3090).
Setup on Clinical Dataset. To conduct the experiment under domain generalization setting, divide these subjects in a clinical dataset into groups, each group contains subjects (detailed grouping information is listed in Table 4). For model training and testing, we adopt "2-1-1 setting" for the division of training, validation, and test sets. Specifically, we assign two groups to the training set and one group to the validation set, collectively forming the source domains. Additionally, assign another group as the target domain for testing. For a comprehensive experiment, we conduct the experiments under 12 different grouping combinations (detailed settings in Table To reduce computational load, we downsample the data to 250Hz. The length the patch is set to second (250 data points). More experimental details, including model and optimization settings, listed in Table 2
Setup Public Dataset. For the public dataset, we employ the grouping strategy mentioned in [39] Specifically, we divide these subjects into groups. We adopt "4-1-1 setting" for model training, validation, and testing, respectively: randomly choose 5 groups (4 testing groups and I validation group) as the source domain, while the other one group as the target domain for testing. For the public dataset, conduct the experiments under 6 different grouping combinations (detailed setups Table 15). Moreover, because the public dataset is sampled data, there no complete channel data, so for DMNet with public data, remove the channel-level reference. More experimental details, including model and optimization settings are listed in Table
E Full Visualization of Seizure Evolution Process
To additional illustrate the effectiveness of our proposed DMNet, we present the visualization results of the difference matrix throughout the entire seizure process in Fig. g The upper figure shows the

---

Timestamp
Aumuu aompemmmaaaa w
Mean
20-24
Frequency
80-84
100-104
120-124
(a)
(b)
(c)
(d)
(e)
Figure 8: Illustration of how difference matrices reflect seizure activity changes during seizure evolution process. Purple line refers to seizure waves, gray line refers to normal waves.
raw iEEG signal that contains complete seizure process, where the gray wave represents the normal signal and the purple wave represents the seizure. The green masked blocks indicate the segments for detection. Notably, distinctions between seizure and normal matrices are evident during the evolution of the seizure. For segments that are temporally closer to the seizure events, the difference matrices tend to be rougher (e.g.. segments c, d, and e) and vice versa (e.g., segments a, b, and g). In summary, this case clearly illustrates how the difference matrix captures the seizure activity changes different frequency bands, and indicates the effectiveness our proposed method.
F Generalization Ability Analysis
To further evaluate the generalization capability of DMNet across a wider range of subjects with greater heterogeneity, we assessed the model using data from the extensive TUSZ EEG dataset [I] which encompasses numerous subjects. After data preprocessing, we retained data from 179 subjects, dividing them into training, validation, and testing sets in a 6:2:2 ratio, with distinet subjects in each split. Please refer to Tab, 6 for the results of the experiment. The results indicate that DMNet
18

---

Table 6: Performance of DMNet on TUSZ Dataset.
Dataset
TUSZ
Model
Pre.
Rec.
F1
F2
Abou-Abbas al.
25.03
57.20
36.27
43.88
13.881
13.382
14.528
13.181
Zhao et al.
23.74
49.73
30.28
42.41
+1.502
#3.467
+1.022
#3.285
Dissanayake et al.
28.67
54.91
36.70
49.15
43.29-1
#1.492
+2.587
+5.128
SICR
32.54
61.32
40.71
50.45
#1.01
#5.062
+3.296
#1.57
SEEGNet
34.16
58.20
45.34
52.63
14.381
15.124
14.213
15.648
PPi
36.49
62.72
49.69
56.09
15.682
1.4.882
15.107
14.784
DMNet
48.87
67.59
56.56
65.86
#2.520
#4.834
+3.341
#2.972
Table 7: Full average performance with standard deviation of of subject-independet seizure detection
tasks on clinical dataset. The v indicates the first in a column and y indicates the second.
Dataset
Clinical
Model
Pre.
Rec.
F1
F2
SelfReg
51.60
48. 44.
51.24 138
48.63 48.6342.98
GroupDRO
47.60+1.760
44. 34.7443.12
45.15+1.920
1..90
MTL
20.4643.350
52. 52.33+4.00
28.59
39. 19.1142..69
CORAL
38.70 435
49. 19..2++3.899 8.8
42.01++2.620
17.66422.88
CDANN
33.43
40.41
35. 35.72.t5.01
37 37.5844.666 6.666
SD
18.6942.473
54.40 13.823
28.78+22600
40.8 40.8142.6415
IB IRM
29.19 11.48
49.75
37.91 12.003
42.6 12.208
VREx
44.80
32.45.3.745
36.331.2.50
35.34 12.613
IB ERM
40.30 11.301
37.40
37.59 11.800
37.19 12.125
TRM
34.03 0223
42. 42.74+4.285
38.93
41.58
Abou-Abbas et al.
43.24
45.84
43. 13.1541..71
46.95.14.550
Zhao et al.
30.1743.630
49. 44.88
36. 16444.16
42.65.44.443
Dissanayake et al. SICR
40.12:44.853
39.29 19.299662 39.2946.403
38.30
40.82.66.10
46.27
45. 45.6545.380 43.9146.253
13.86415.65
SEEGNet PPi
44.89
47. 1.355
46. 25.225-6..0 6.442
47. 1
51.72 1..847
49.70 75+7.712
49.78 7-.0788
51. 1L.1221..99
DMNet
55.24 59.58
54.49 43.19
$5.93_3.770
DMNet w/o Lee
48.
48.25+4.110
53.30 03.3043..80 859
49. 19.622+3.855
51.20, 13.0996
DMNet w/o Le
51.39
47. 43 14.107
47. .T.322.1 1.4953
47. 15 1..122
DMNet w/o DM
13.5814..62
45. 43..77
46. 46.72.:3.205
43. 43.42.14.822 F-.833
consistently outperforms existing SOTA models, demonstrating its effectiveness in seizure detection on EEG dataset with numerous subjects.
G
Full Result
H
Limitations
There are two main limitations to my approach. Firstly, it lacks a theoretical foundation, which may call into question the effectiveness and reliability of the method. It becomes challenging to explain and justify the underlying principles behind the approach. Secondly, although the method is efficient, suffers from limited number of parameters. This limitation can potentially impact the generalizability the method. Therefore, while the method may show promising results specific contexts, caution should be exercised when applying it to broader unfamiliar situations.
19

---

Table 8: Full average performance with standard deviation of of subject-independen seizure detection tasks on MAYO. The indicates the first in a column and y indicates the second.
Dataset
MAYO
Model
Pre.
Rec.
F2
SelfReg
60.40
32. 12.131
36. 13.4422
32. 13.988
GroupDRO
48.31 17.228
35.00 55.00199.55
27.82
28. 28.04 16.823
MTL
46.87 +6.840
22.08.7.0
15.68+4.915
16.3 +5.304
CORAL
62.17 +7.833
29.8649.838
22.01 22.01+7.430 20.41+7.335
CDANN
36.7945.453
79. 49.55444.335
45.49+5.678
56.60+4.843
SD
47.73
55.59+44.735
46.97
50.35++44488
IB IRM
47.57
57. 57.1715.313
46.8646.009
50. 50.71+5.490
VREx
16.15
59. 59.95+55.22
51.19+55.738
54.85++5.500
IB ERM
46.2916.553
57 57.36.14.405
47.21 47.21 15.300
51.44
TRM
47.55.1..498
58.97 144785
43.96_14.788
47.87 47.87 1.3.473
Abou-Abbas et al.
48.47 1:4.89
51.4015.690
50.69
18.86115.29
Zhao et al.
37.07 1:4.444
56.06 144.668
26.17144.367
38.48 1.4.80
Dissanayake et al.
50.39-16.033
68. 19.9494433
57 37.69.1338838
64.8213.173
SICR
79.01 #3.980
63. 20.29...m + 058
03.29443.00
69. 69.88+2.200
66.17 66.17+2.622
SEEGNet
71.82+47.41
60. 10.550433.00 0.0
63.87
63. 13.1143.3340
PPi
74.4948.530
70.21 4:2725
72.28 43.988
71.02+33.70
DMNet
68.82247.168
90.06 1.227
13.038
81.54.13.283 1:3.283
DMNet w/o Lee
47. 47.10.14.055
89. $9.15. 15.15+3..0 688
62. 62.63342.249
76.43+5.50
DMNet w/o Le
58.34+ 1.825
76. 1.608
64.28
71.79+ 11.7941.22
DMNet w/o DM
49.67 +5.303
71.54+1.553
60. 60.63+4..0 4.825
66.57 04..772..800 808
Table 9: Average performance with standard deviation of of subject-independens seizure detection tasks on FNUSA. The indicates the first in a column and y indicates the second.
Dataset
FNUSA
Model
Pre.
Rec.
F2
SelfReg
62.34
48.1946..6
19.2044.411
47.73.5.630
GroupDRO
53.48444.38
71.44
60. 60.47-43.72
66.38.33.66
MTL
60.0444..08.
52.6445.172
53.90+4.299
52.8344.770
CORAL
43.615
53. 53.23-55.395
55.93-14.285
53.88
CDANN
64.37
54.8545.555
54.35
53.8644.520
SD
56.99+1.583
57. 57.97 57.97+11.970 1.970
55.42
56.45+1.210
IB IRM
54.22++1.985
63. 26
55.9643.503
59.47+3.766
VREx
54.74+41.23
60. 10.1545..55
54. 541.44+4.010
57. 17.1334.55
IB ERM
54.64.14.948
55. 15.26.15 5..66
52.68
53. 13.70..4 70..7.44.600
TRM
6..284
58. 68.156
56.00.1-..325
56. 56.74115.21
Abou-Abbas et al.
49.83++4.213
56.90-+4.366
52.33
57.53 1:..1144112
Zhao et al.
41.644:3.00
44.20
40.62.t0.70 0.79
42. 12.12:h 12.1221..22
Dissanayake et al. SICR
03.85466.988
76.01 76.01+3.877
63. 63.75++4.368
67 .7.99442..95
63.78 43..84
66. 66.7744.078
64. 24.255.m 43:3353
65. 65.1044.744
SEEGNet
62.23
72.35
66.81 66.81 4-3337
08.99113.89
PPi
59.53 1.4.83
75.42
65.83
71.59+4.515
DMNet
12.30.5..775
85.39 122623
67.80 13.795
75.15 75.15.1..40 1.4460
DMNet w/o Let
52.57 +6.623
78. 78.4944..00 4-.322
60.99 +3.959
70. 70.7543 908
DMNet w/o Le
49.28 00.284661144 155
73.48 44.488
58. 1243.2272
65. 23 686
DMNet w/o DM
46.9816.225
66.8944.00
56. 56.21
62. 18 18.4.444
20

---

NeurIPS Paper Checklist
1. Claims
Question: Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope?
Answer: [Yes]
Justification: In this paper, abstract and introduction accurately reflect the paper's contribu- tions and scope.
Guidelines:
The answer NA means that the abstract and introduction do not include the claims made the paper.
The abstract and/or introduction should clearly state the claims made, including the contributions made in the paper and important assumptions and limitations. A No or
NA answer to this question will not be perceived well by the reviewers.
The claims made should match theoretical and experimental results, and reflect how much the results can be expected to generalize to other settings.
is fine to include aspirational goals as motivation as long as is clear that these goals not attained by the paper.
2. Limitations
Question: Does the paper discuss the limitations the work performed by the authors?
Answer: [Yes]
Justification:
The limitations of the work discussed in Appendix H
Guidelines:
The answer NA means that the paper has no limitation while the answer No means that the paper has limitations, but those are not discussed in the paper.
The authors are encouraged to create a separate "Limitations" section their paper.
The paper should point out any strong assumptions and how robust the results are to violations of these assumptions (e.g.. independence assumptions, noiseless settings, model well-specification, asymptotic approximations only holding locally). The authors should reflect how these assumptions might be violated in practice and what the implications would be.
The authors should reflect on the scope of the claims made, e.g., if the approach was only tested on few datasets or with few runs. In general, empirical results often depend on implicit assumptions, which should be articulated.
The authors should reflect on the factors that influence the performance of the approach. For example, facial recognition algorithm may perform poorly when image resolution is low images are taken in low lighting. Or speech-to-text system might not be used reliably to provide closed captions for online lectures because it fails to handle technical jargon.
The authors should discuss the computational efficiency of the proposed algorithms and how they scale with dataset size.
If applicable, the authors should discuss possible limitations of their approach to address problems of privacy and fairness.
While the authors might fear that complete honesty about limitations might used by reviewers as grounds for rejection, worse outcome might be that reviewers discover limitations that aren't 't acknowledged judgment and recognize that individual actions in favor of transparency play impor- tant role in developing norms that preserve the integrity of the community. Reviewers will be specifically instructed to not penalize honesty concerning limitations.
the paper. The authors should use their best
3. Theory Assumptions and Proofs
Question: For each theoretical result, does the paper provide the full set of assumptions and complete (and correct) proof?
Answer: [NA]
21

---

Justification:
The paper does not include theoretical results
Guidelines:
The answer NA means that the paper does not include theoretical results.
All the theorems, formulas, and proofs in the paper should be numbered and cross- referenced.
All assumptions should be clearly stated referenced in the statement of any theorems.
The proof' can either appear the main paper or the supplemental material, but they appear in the supplemental material, the authors are encouraged to provide short proof sketch to provide intuition.
Inversely, any informal proof provided in the core of the paper should be complemented by formal proofs provided in appendix or supplemental material.
Theorems and Lemmas that the proof relies upon should properly referenced.
4. Experimental Result Reproducibility
Question: Does the paper fully disclose all the information needed to reproduce the main ex- perimental results of the paper to the extent that affects the main claims and/or conclusions of the paper (regardless of whether the code and data are provided or not)?
Answer: [Yes]
Justification:
The private dataset so one may cannot reproduce the experiments on the private dataset. However, we also use another two public datasets, and the code of our work fully provided too, which could help you understand our work.
Guidelines:
The answer NA means that the paper does not include experiments.
If the paper includes experiments, a No answer to this question will not be perceived well by the reviewers: Making the paper reproducible is important, regardless of whether the code and data are provided or not.
If the contribution is dataset and/or model, the authors should describe the steps taken make their results reproducible or verifiable.
Depending on the contribution, reproducibility can be accomplished in various ways. For example, if the contribution is novel architecture, describing the architecture fully might suffice, or if the contribution a specific model and empirical evaluation, it may be necessary either make it possible for others to replicate the model with the same dataset, or provide access to the model. In general. releasing code and data is often one good way accomplish this, but reproducibility can also be provided via detailed instructions for how to replicate the results, access to a hosted model (e.g., in the case of large language model), releasing of a model checkpoint, or other means that appropriate to the research performed.
While NeurlPS does not require releasing code, the conference does require all submis- sions to provide some reasonable avenue for reproducibility, which may depend on the nature of the contribution. For example
(a) the contribution is primarily a new algorithm, the paper should make clear how reproduce that algorithm. (b) If the contribution is primarily new model architecture, the paper should describe the architecture clearly and fully.
(c) the contribution is a new model (e.g., a large language model), then there should either be way to access this model for reproducing the results or way to reproduce the model (e.g., with an open-source dataset instructions for how to construct the dataset).
(d) We recognize that reproducibility may be tricky in some cases, in which case authors are welcome describe the particular way they provide for reproducibility. In the case of closed-source models, it may be that access to the model is limited in some way (e.g., to registered users), but it should possible for other researchers to have some path to reproducing or verifying the results.
5. Open access to data and code
22

---

Question: Does the paper provide open access to the data and code, with sufficient instruc- tions faithfully reproduce the main experimental results, as described in supplemental material?
Answer: [Yes]
The private dataset may cannot reproduce the experiments the private dataset. However, we also use another two public datasets, and the code of our work is fully provided too, which could help you understand our work.
Justification:
Guidelines:
The answer NA means that paper does not include experiments requiring code.
Please see the NeurIPS code and data submission guidelines (https://nips.com cc/
for more details.
While we encourage the release of code and data, we understand that this might not be possible, "No" is an acceptable answer. Papers cannot be rejected simply for not including code, unless this is central to the contribution (e.g., for a new open-source benchmark).
The instructions should contain exact command and environment needed to run to reproduce the results. See the NeurlPS code and data submission guidelines (https
y /nips. http:/ccccccccguueeeeeeeeeeeeeee wwaccc/guiies/eee httppb/l///giiieeddeeeeeaaaaaaia
for more details.
The authors should provide instructions on data access and preparation, including how access the raw data, preprocessed data, intermediate data, and generated data, etc.
The authors should provide scripts to reproduce all experimental results for the new proposed method and baselines. only subset of experiments are reproducible, they should state which ones are omitted from the script and why.
At submission time, to preserve anonymity, the authors should release anonymized versions (if applicable).
Providing as much information as possible in supplemental material (appended to the paper) recommended, but including URLs to data and code permitted.
6. Experimental Setting/ettails
Question:
Does the paper specify all the training and test details (e.g., data splits, hyper- parameters, how they were chosen, type of optimizer, etc.) necessary understand the results?
Answer: [Yes]
Justification:
We give detailed description of our experiment setting in Appendix D We
also do a hyperparameter analysis the Section 5
Guidelines:
The answer NA means that the paper does not include experiments.
The experimental setting should be presented in the core of the paper to level of detail that is necessary to appreciate the results and make sense of them.
The full details can be provided either with the code, in appendix, as supplemental material.
7. Experiment Statistical Significance
Does the paper report error bars suitably and correctly defined or other appropriate information about the statistical significance of the experiments?
Question:
Answer:
[Yes]
Justification:
The standard derivation shown in the Appendix G
Guidelines:
The answer NA means that the paper does not include experiments.
The authors should answer "Yes" if the results are accompanied by emor bars, confi- dence intervals, or statistical significance tests, least for the experiments that support the main claims of the paper.
23

---

The factors of variability that the error bars are capturing should be clearly stated (for example, train/test split, initialization, random drawing of some parameter, or overall run with given experimental conditions).
The method for calculating the error bars should be explained (closed form formula, call to a library function, bootstrap, etc.)
The assumptions made should be given (e.g.. Normally distributed errors).
It should be clear whether the error bar is the standard deviation the standard error of the mean.
It is OK to report 1-sigma error bars, but one should state it. The authors should preferably report a 2-sigma error bar than state that they have 96% CI, if the hypothesis of Normality of errors is not verified.
For asymmetric distributions, the authors should be careful not show in tables figures symmetric error bars that would yield results that are out range (e.g. negative error rates).
error bars are reported in tables or plots, The authors should explain the text how they were calculated and reference the corresponding figures or tables in the text.
8. Experiments Compute Resources
For each experiment, does the paper provide sufficient information on the com- puter resources (type of compute workers, memory, time of execution) needed reproduce the experiments?
Question:
Answer: [Yes]
Justification: We provide information about Experiments Compute Resources such as CPU, GPU, etc. in the Appendix D
Guidelines:
The answer NA means that the paper does include experiments.
The paper should indicate type of compute workers CPU or GPU, internal cluster, or cloud provider, including relevant memory and storage.
The paper should provide the amount of compute required for each of the individual experimental runs as well as estimate the total compute.
The paper should disclose whether the full research project required more compute than the experiments reported in the paper (c.g., preliminary or failed experiments that didn't 't make into the paper).
9. Code Of Ethics
Question: Does the research conducted in the paper conform, in every respect, with the NeurlPS Code of Ethics http::
Answer: [Yes]
Justification:
All authors reviewed and conducted the NeurIPS Code of Ethics.
Guidelines:
The answer NA means that the authors have reviewed the NeurIPS Code of Ethics.
the authors answer No, they should explain the special circumstances that require deviation from the Code of Ethics.
The authors should make sure to preserve anonymity (c.g.. if there special consid- eration due to laws or regulations in their jurisdiction..
10. Broader Impacts
Question: Does the paper discuss both potential positive societal impacts and negative societal impacts of the work performed?
Answer: [No]
Justification: There is social impact of the work performed.
Guidelines:
The answer NA means that there is no societal impact of the work performed.

---

If the authors answer NA or No, they should explain why their work has no societal impact or why the paper does not address societal impact.
Examples of negative societal impacts include potential malicious or unintended uses (e.g., disinformation, generating fake profiles, surveillance), fairness considerations (e.g., deployment of technologies that could make decisions that unfairly impact specific groups), privacy considerations, and security considerations.
The conference expects that many papers will be foundational research and not tied to particular applications, let alone deployments. However, if there is direct path to any negative applications, the authors should point it out. For example, it is legitimate to point out that improvement in the quality of generative models could be used to generate deepfakes for disinformation. On the other hand, it is not needed to point out that generic algorithm for optimizing neural networks could enable people to train models that generate Deepfakes faster.
The authors should consider possible harms that could arise when the technology is being used as intended and functioning correctly, harms that could arise when the technology is being used as intended but gives incorrect results, and harms following from (intentional or unintentional) misuse of the technology.
If there are negative societal impacts, the authors could also discuss possible mitigation strategies (e.g., gated release of models, providing defenses in addition attacks, mechanisms for monitoring misuse, mechanisms to monitor how system learns from feedback over time, improving the efficiency and accessibility of ML).
11. Safeguards
Does the paper describe safeguards that have been put in place for responsible release of data models that have high risk for misuse (e.g., pretrained language models, image generators, or scraped datasets)?
Question:
Answer: [No]
Justification:
This paper poses no such risks.
Guidelines:
The answer NA means that the paper poses no such risks.
Released models that have high risk for misuse or dual-use should be released with necessary safeguards to allow for controlled use of the model, for example by requiring that users adhere to usage guidelines or restrictions to access the model or implementing safety filters.
Datasets that have been scraped from the Internet could pose safety risks. The authors should describe how they avoided releasing unsafe images.
We recognize that providing effective safeguards challenging, and many papers do not require this, but we encourage authors to take this into account and make best faith effort.
12. Licenses for existing assets
Are the creators or original owners of assets (e.g.. code, data, models), used in the paper, properly credited and the license and terms of use explicitly mentioned and properly respected?
Question:
Answer: [Yes]
Justification:
All the existing assets are properly referenced.
Guidelines:
The answer NA means that the paper does not use existing assets.
The authors should cite the original paper that produced the code package dataset.
The authors should state which version of the asset used and, possible, include URL
The name of the license (e.g., CC-BY 4.0) should be included for each asset.
For scraped data from a particular source (e.g., website), the copyright and terms of service of that source should be provided.
25

---

If assets are released, the license, copyright information, and terms of use in the thcode. has curated licenses for some datasets. Their licensing guide can help determine the license of dataset.
package should be provided. For popular datasets, paperswi
latasets.paperssi
For existing datasets that are re-packaged, both the original license and the license of the derived asset (if it has changed) should be provided.
If this information not available online, the authors are encouraged to reach out to the asset's s creators.
13. New Assets
Question: Are new assets introduced in the paper well documented and is the documentation provided alongside the assets?
Answer: [Yes]
Justification: Our code is provided as supplement.
Guidelines:
The answer NA means that the paper does not release new assets.
Researchers should communicate the details of the dataset/code/moode as part of their submissions via structured templates. This includes details about training, license, limitations, etc.
The paper should discuss whether and how consent obtained from people whose asset is used.
At submission time, remember to anonymize your assets (if applicable). You can either create an anonymized URL or include an anonymized zip file.
14. Crowdsoureing and Research with Human Subjects
Question: For crowdsourcing experiments and research with human subjects, does the paper include the full text of instructions given to participants and screenshots, if applicable, as well details about compensation (if any)?
Answer: [NA]
Justification: This paper does not involve crowdsourcing nor research with human subjects.
Guidelines:
The answer NA means that the paper does not involve crowdsourcing nor research with human subjects.
Including this information the supplemental material is fine, but if the main contribu- tion of the paper involves human subjects, then as much detail as possible should be included in the main paper.
According to the NeurIPS Code of Ethics, workers involved in data collection, curation, or other labor should be paid at least the minimum wage in the country of the data collector.
15. Institutional Review Board (IRB) Approvals or Equivalent for Research with Human Subjects
Question: Does the paper describe potential risks incurred by study participants, whether such risks were disclosed to the subjects, and whether Institutional Review Board (IRB) approvals (or equivalent approval/review based the requirements of your country institution) were obtained?
Answer: [No]
Justification: This paper does involve crowdsoureing nor research with human subjects.
Guidelines:
The answer NA means that the paper does not involve crowdsourcing research with human subjects.
Depending the country in which research is conducted, IRB approval (or equivalent) may be required for any human subjects research. If you obtained IRB approval, you should clearly state this in the paper.
26

---

We recognize that the procedures for this may vary significantly between institutions and locations, and we expect authors adhere the NeurIPS Code of Ethics and the guidelines for their institution.
For initial submissions, do not include any information that would break anonymity (if applicable), such as the institution conducting the review.
27


Reviews:
[{"review_id": "mYk20PmMjT", "reviewer": "Reviewer_sFSG", "summary": "The paper proposes DMNet, a Difference Matrix-based Neural Network for subject-independent seizure detection using intracranial electroencephalography (iEEG). The model addresses the domain shift in iEEG signals across different subjects by leveraging a self-comparison mechanism that aligns iEEG signals and encodes universal seizure patterns. DMNet utilizes contextual and channel-level references to mitigate shifts and employs a difference matrix to capture seizure activity changes effectively. The authors report that DMNet outperforms state-of-the-art models and is highly efficient in real-world clinical applications.", "questions": "See weakness above.", "limitations": "I didn't find a discussion on the limitations of this work.", "rating": 5, "confidence": 5, "soundness": 3, "presentation": 3, "contribution": 2, "strengths": "1. The proposed self-comparison mechanism seems like a reasonable approach to alleviate inter-subject and intra-subject distribution shift. \n\n2. Presentation is clear and easy to follow, especially in the methodology section, where figures are helpful for understanding. Overall, the paper is well written.\n\n3. Although this model is tailored for iEEG data, it seems straightforward to be generalized for EEG data.", "weaknesses": "1. If the right side R_cl merely reverses the left side L_cl, is it redundant?\n\n2. The three datasets used for evaluation have small numbers of subjects. Could the authors include an experiment on EEG data with more subjects?\n\n3. On MAYO and FNUSA, where positive sample ratio is non-trivial, the model has a much higher recall than precision, showing it’s prone to false positives. Do the authors have some preliminary justifications/explanations for this feature?\n\n4. The performance improvement is incremental. In Table 1, if we check F1 score which is a combination of Recall and Precision, we find that on MAYO and FUNSA, the proposed model only outperforms the best baseline for around 1%. Without std reported, we cannot judge is the increment is caused by randomness. On Clinical dataset, the margin is 3% which is good.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "**w1: Clarify why reverse the L_cl to form R_cl and concatenate it on the right**.\n\nThanks for pointing this out. The detail explanation please refer to **GR1** in **Global Response.**\n\n**w2: Discuss the number of subjects in iEEG dataset  & Additional EEG datasets containing a large number of subjects were added for the experiment.**\n\n1. Thank you for pointing that out. Obtaining intracranial EEG (iEEG) recordings is challenging as it requires craniotomy surgery for electrode implantation, which involves extensive protocols and approvals. Therefore, in the field of intracranial neural signals, the number of subjects in datasets has not reached the scale of EEG datasets. Some other works in this field also contain a limited number of subjects (e.g., [1] contains 10 subjects, [2] contains 10 subjects). We are also collaborating with medical institutions to release more data, aiming to improve the situation of insufficient data in the field of iEEG.\n\n2. Thank you for this good suggestion. I have conducted experiments on a large EEG dataset TUSZ[3] with numerous subjects, and after data preprocessing, we retained data from 179 subjects, dividing them into training, validation, and testing sets in a 6:2:2 ratio, with distinct subjects in each split. Please refer to **Table 1** in the attached **PDF** of **Global Response** for the results of the experiment. The results indicate that DMNet consistently outperforms existing SOTA models, demonstrating its effectiveness in seizure detection on EEG dataset with numerous subjects.\n\n**w3: Discuss why the model has a higher recall than precision on 2 public datasets.**\n\nThank you for this insightful question. The reason our model has a high false positive rate is that the design of DMNet revolves around learning more general seizure patterns. We aim for DMNet to be sensitive to potential seizure events, so that the model minimizes missing any seizures in real clinical applications.  Please note that in most clinical cases, we are more concerned with false negative rates, as the cost of missing positive cases will be far higher than that of false positive cases (for more details, please refer to our response regarding w4). In our results, the higher F2 score of our model also demonstrates the effectiveness of DMNet in identifying seizure events.\n\nIn the MAYO and FNUSA datasets,the positive-to-negative sample ratios are 0.21 and 0.36, respectively.  The normal events in MAYO and FNUSA have been down-sampled [4], which will lead to insufficient learning of the general pattern of normal samples, and the model is easy to misjudge normal samples as positive examples, which increases the false positive rate. On the contrary, the clinical dataset was not sampled at all, and the positive and negative sample rate was 0.003. With a large number of normal samples for training, the model could better learn the general representation of normal samples, which made the model have a small false positive rate on the clinical dataset.\n\n**w4: Discuss the performance improvement of DMNet.**\n\nThank you for pointing that out. Although the improvement of F1 is not significant, the improvement of F2 significantly outperforms all baselines.  Please note that in the field of epilepsy, the F2 metric is more widely employed to evaluate models [1,2]. In addition, the results of std can be found in the appendix.\n\nThere are two reasons for why F2 matter in clinical scenario:\n\n1. In most of clinical scenario, we oftern focus more on the identification of postive event, i.e., emphasis on recall (sensitivity). It is because that the cost of missing a positive case (false negative) would be much higher than the cost of a false positive.\n\n2. Medical datasets often suffer from significant class imbalance, with the positive class being much rarer than the negative class.\n\n[1]Chen J, Yang Y, Yu T, et al. Brainnet: Epileptic wave detection from seeg with hierarchical graph diffusion learning, KDD2022.\n\n[2]Wang C, *et al.*, \"BrainBERT: Self-supervised representation learning for intracranial recordings.\" ICLR2023\n\n[3]Shah, Vinit et al. “The Temple University Hospital Seizure Detection Corpus.” *Frontiers in Neuroinformatics* 12 (2018): n. pag.\n\n[4]Petr Nejedly, el. Multicenter intracranial EEG dataset for classification of graphoelements and artifactual signals. Scientific Data", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "PDDEUPNcIN", "reviewer": "Reviewer_s7PY", "summary": "This paper revolves around subject-independent seizure detection using intracranial electroencephalography (iEEG) signals. The primary challenge is the domain shift in iEEG signals across different subjects, which hinders the generalization of seizure detection models to new subjects. Existing models often fail to adapt to these domain shifts, leading to reduced performance in subject-independent scenarios.\n\nThe authors highlight the limitations of existing iEEG models, which struggle with subject-independent seizure detection due to the variability in iEEG signals across individuals. Previous approaches have not effectively addressed the domain shift issue, resulting in suboptimal performance when applied to new subjects. This sets the stage for the need for a novel model like DMNet that can overcome these challenges and improve subject-independent seizure detection.\n\nThe authors have employed a self-comparison mechanism within DMNet, allowing the model to compare iEEG signals within the same subject and across different subjects. This mechanism enables DMNet to learn subject-independent representations of seizure patterns, enhancing its generalization capabilities. Additionally, the novel neural network architecture of DMNet is tailored to leverage these self-comparisons efficiently, leading to improved performance in subject-independent seizure detection tasks.", "questions": "1.\tCould you provide more detailed insights into how the domain shift in iEEG signals manifests across different subjects?\n\n2.\tHow does DMNet specifically address and mitigate this domain shift issue? Are there any theoretical or empirical justifications for the effectiveness of this approach in handling these shifts?\n\n3.\tCan you provide a detailed comparison between DMNet and existing iEEG models for subject-independent seizure detection in terms of key performance metrics such as sensitivity, specificity, and computational efficiency?\n\n4.\tCan you provide details on the experimental setup, including data preprocessing, model training, hyperparameter tuning, and the evaluation metrics used?\n\n5.\tHow does DMNet fare in real-world clinical applications for subject-independent seizure detection?\n\n6.\tHave there been any pilot studies or practical implementations of DMNet in clinical settings? What were the findings regarding its effectiveness and usability?\n\n7.\tWhat are the potential challenges or limitations in deploying DMNet in real clinical scenarios, and how does the model address these to ensure practical utility and scalability?", "limitations": "The authors have adequately addressed the limitations and identified no potential negative societal impacts of their work.", "rating": 5, "confidence": 4, "soundness": 3, "presentation": 4, "contribution": 3, "strengths": "1.\tDMNet addresses the critical challenge of domain shift across different subjects, a problem that has limited the effectiveness of previous models.\n2.\tThe self-comparison mechanism allows DMNet to learn representations of seizure patterns that are independent of the subject. This feature enhances the model's ability to perform effectively across new subjects without additional training.\n3.\tThe paper presents a novel neural network architecture specifically designed to utilize the self-comparison mechanism efficiently. This architecture is expected to optimize the performance of the seizure detection model, making it more effective in a variety of clinical settings.", "weaknesses": "1.\tThe paper lacks extensive experimental validation across diverse datasets. This limitation restricts the demonstrated generalizability and robustness of DMNet. For stronger validation, experiments on multiple, varied iEEG datasets would be necessary to affirm the model's efficacy across different scenarios.\n2.\tThe paper could benefit from a more thorough explanation of the theoretical foundations of DMNet. Providing detailed assumptions and complete proofs for the methodologies proposed would enhance the rigor of the research and strengthen the credibility of the model’s theoretical underpinnings.\n3.\tThe model's architecture, characterized by a limited number of parameters, may hinder its adaptability and performance in diverse situations. While the simplicity of fewer parameters might benefit specific conditions, it could limit the model’s ability to handle new or complex data effectively. This could affect the model's application in broader or more varied contexts.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "**w1: Additional cross-dataset experiments to verify the efficacy of DMNet across different scenarios.**\n\nThank you for the good suggestion. I conducted 3 cross-dataset experiments on Clinical, MAYO, and FNUSA. We select one dataset for training and validation set (with distinct subjects), and the other two datasets for testing. For detailed results, please refer to **Tables 2, 3, and 4** in the attached **PDF** within the **Global Response.**\n\nThe results showed that DMNet outperforms the existing SoTA, especially in F2. In addition, the performance was degraded relative to experiments with cross subject on a single dataset. This may be attributed to varying annotation standards across different medical institutions, as well as individual annotation preferences among different annotators.\n\n**w2&q2: Discussion of the theoretical foundations of DMNet.**\n\nThank you for the insightful question. The detail explanation please refer to **GR3** in **Global Response.**\n\n**w3: Discussion  DMNet with few parameters.**\n\nThank you for your valuable comments on our research. My response consists of 2 parts:\n\n1. In real-world epilepsy diagnosis, numerous lengthy iEEG files require processing. Given equipment constraints, efficient ML methods are crucial. Although DMNet has a limited number of parameters, it has achieved near-optimal performance on different datasets while maintaining shortest processing times.\n\n2) Although the model has a limited number of parameters, our design offers good flexibility and scalability. By changing the differential matrix encoder (adopting more complex neural network models), we can further improve model performance to address broader application scenarios.    \n\n**q1: Discuss the domain shift in iEEG signals manifests across different subjects**\n\nThank you for the valuable comment. Our response includes two parts:\n\n1. **Inter- and intra-subject variability.** The inter-subject variability could be attributed to the factors of age, gender, and living habits, which would be related to the brain topographical and electrophysiology[1]. The intra-subject variability would be explained as the changes of psychological and physiological, such as fatigue, relaxation, and concentration[2].\n\n2. **iEEG recording experiment. iEEG.** For each subject, doctors need to design an individual electrode implantation based on the subject's profile, including the number and positions of each electrode to be implanted. Variations in electrode placement across subjects can lead to differences in signal properties, such as the specific brain regions being monitored, the distance between electrodes, and the orientation of electrodes relative to neural sources[3]. These differences can cause domain shift in iEEG signals across different subjects.\n\n**q3: Clarify the detailed comparison between DMNet and existing iEEG models.**\n\nI am very sorry that I did not mention that recall is sensitivity and precision is specificity. DMNet significantly outperforms existing iEEG models like SICR, SEEGNet, and PPi in terms of F2, sensitivity (recall) and F1. Detail experiment result please refer to Secion 5.2 in the paper. For the Computational Efficiency, this part can be referred to Section 5.6. \n\n**q4: Clarify details on the experimental setup.**\n\n**Data Preprocessing.** Public datasets are preprocessed by removing power line noise and downsampling to 2500Hz. Clinical datasets undergo similar preprocessing, downsampled to 250Hz. We will include these steps in our manuscript for clarity.\n\n**Data Division in Model Training and Hyperparameter Tuning.** The details please refer to **GR2** in **Global Response.**\n\n**Evaluation Metrics.** We use F2-score as primary metric for performance comparison, because missing any seizure event can be costly in clinical diagnosis. And we also consider Precision, recall, F1-score. \n\n**q5: Discuss how DMNet fares in real-world clinical applications**\n\nDMNet has been successfully deployed in an online system for real-time seizure detection. DMNet can process iEEG data of approximately 10 hours in around 45 seconds, demonstrating its efficiency for real application scenario. Please refer to section 5.6 for a detailed description of the online system.\n\n**q6: Discuss the  pilot studies or practical implementations of DMNet?**\n\nYes, DMNet has undergone pilot testing in a clinical setting. Compared to older models used in hospitals, DMNet can identify epileptic seizures more quickly and accurately. Notably, based on feedback from doctors, it can process iEEG data in real-time, providing detection results to assist doctors rapidly. This reduces the labor costs associated with doctors having to monitor iEEG data for extended periods.\n\n**q7: Discuss  the potential challenges or limitations in deploying DMNet?**\n\n1. Incremental Training: Challenges in incremental training emerge when incorporating new subjects, potentially leading to overfitting and knowledge forgetting. We try to apply LoRA[4] for post-training on new subjects. By retaining the original parameters and adjusting only a small additional learnable parameters, we mitigate the risks of overfitting and forgetting.\n2. Limited Parameters: As subject numbers grow, epilepsy detection complexities rise. Limited model parameters can hinder generalization. We can replace the differential matrix encoder with more complex neural networks to increase the model's parameter capacity for dealing with more complex scenarios.\n\n[1] Seghier ML, Price CJ. Interpreting and Utilising Intersubject Variability in Brain Function. Trends Cogn Sci. 2018\n\n[2] Meyer MC, et al. Electrophysiological correlation patterns of resting state networks in single subjects: a combined EEG-fMRI study. Brain Topogr. 2013\n\n[3] Shi H, et al. Utility of intracranial EEG networks depends on re-referencing and connectivity choice[J]. Brain Communications, 2024.\n\n[4] Hu E , et al. Lora: Low-rank adaptation of large language models[J]. arXiv:2106.09685, 2021.", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "HYeTQlEt8A", "reviewer": "Reviewer_EpQU", "summary": "The paper presents a seizure detection approach for spotting seizure segments in long recordings by comparing the differences in spectral content between the target segment to be labeled and surrounding context segments and some prototypical context segments, obtained as centroids by clustering the channel, along the differences between these segments organized into a matrix. A CNN based network then processes this matrix using the distribution of differences to understand if the differences are indicative of a seizure.  Results show state-of-the-art performance a multiple datasets.", "questions": "Line 82: \"of normal and \" -> \"of normal segments and\"\n\nIn Figure 2(b) it looks like the data has not be high-pass filtered based on the cross-time analysis.  How would high pass filtering affect the proposed methodology as well as the challenges in existing data?\n\nLine 160, as the discrete Fourier transform will be complex valued, it is the sum of the magnitude of the differences, unless only the amplitudes are preserved. Notably, by Parseval's theorem the sum of the squared magnitudes of the differences is the same as the sum of the squared magnitude in the time domain. Thus, as the phase may vary it should be the absolute value of the differences in the magnitude (or squared magnitude).  Later on 196 these are stated to be $d$-dimensional real vectors so the reader can finally assume they are magnitudes (which are non-negative).\n\nI don't understand lines 214–217, why would the clusters have left and right meaning and why would duplicating them in reverse order matter in the construction of the difference matrix? \n\nWhile the left and right windows have ordered information its still not clear why appending the cluster centroids to both sides helps or why a single vector representation of the difference of the target to the rest couldn't be used. The reader is left to guess that the additional differences simply provide context for the differences to the target.\n\nFigure 3 is not sufficient for the neural network architecture. How does the \"global average pooling\"  operate as it seems to take the two previous maxPool2D layers along with the output of the 2 by 2 max pooling... How was this design chosen? \n\n As mentioned in the limitations in the appendix, the method may be limited due to limited parameters to tune during training. I have two suggestions:\n1. Use an ablation on the 2D matrix vectorizing the redundant differences and using a network with full connected layers rather than the matrix organized version processed with a CNN.\n2. Learn weightings on the frequencies.", "limitations": "Limited by unclear operation.", "rating": 5, "confidence": 3, "soundness": 3, "presentation": 3, "contribution": 2, "strengths": "The paper is easy to read with helpful figures and only minor confusions.\n\nThe paper appears to achieve the state of the art performance in seizure detection.", "weaknesses": "There are few points that are not clear  (see questions).\n\nMy main concern is that when looking at the appendix, the data division and hyper-parameter selection is not clear. There is a set of basic hyper-parameters that in Table 2 that seems to be set globally, but now clear how. Then there is a validation set in each split. Perhaps this validation split is used just for choosing the stoping criterion. To choose the best hyper-parameters based on test set performance across all folds is not a valid approach (as it uses test set performance to choose a model architecture). A fair approach would be conduct internally the hyper-parameter selection based on validation in each fold.\n\nOverall, there is lack of intuition (or theory) on when and why organizing the total set of differences into a matrix makes sense. Although it is meaningful to organize neighboring segments there isn't any spatial ordering between centroids differences.  It would seem that multiple branches to compare the none contiguous with 1D convolutions (across frequencies and then channels) before  CNN (bu", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "**w1: Clarify the data division and hyper-parameter selection.**\n\nWe apologize for overlooking the detailed for the data division and hyper-parameter selection. Detailed settings please refer to **GR2** in **Global Response.** We will update this part in the manuscript.\n\n**w2: Discuss the intuition (or theory) on when and why organizing the total set of differences into a matrix makes sense.**\n\nThank you for the insightful question. The detail explanation please refer to **GR3** in **Global Response.**\n\n**q1: Discuss how high-pass filtering affects the proposed methodology and the challenges in existing data.**\n\nThank you for raising this question. Before analyzing most EEG signals, it is necessary to filter the brain's high-frequency signals. However, this preprocess will confuse the model in seizure detection. For example，Some other brain signal components, such as spikes, artifacts or other sharp activities that are not band limited and whose energy can expand to high frequencies may disturb the detection process by generating false oscillations in the filtered signal. That is because by passing through a filter, sharp transients result in short-duration oscillations (close to the filter impulse response) that may easily be confused with real oscillations.  Detailed research conclusions can be found in [1].\n\n**q2: Clarify whether complex numbers or magnitudes are used after the Fourier transform.**\n\nThank you so much for pointing that out. Your analysis is very correct, and we are very sorry that we did not make it clear that we use magnitudes after Fourier transforms are applied to sequence segments. We will update this statement in the final version of the manuscript.\n\n**q3: Clarify why reverse the L_cl to form R_cl and concatenate it on the right.**\n\nThanks for pointing this out. The detail explanation please refer to **GR1** in **Global Response.** We will update this expression in the manuscript.\n\n**q4: Clarify the advantages of using 2-d difference matrix**\n\nThank you for raising this question. As you mentioned, the additional differences provide a context for a richer representation.\n\nWe construct a 2D difference matrix to facilitate the neural network in capturing two types of information: 1. the difference between the target segment and other segments, and 2. the differences between the differences calculated from different segments. A standalone 1D vector only contains the difference information between the target and other segments, lacking local (contextual reference) or global (channel-level reference) differences with other positions. \n\n**q5: Clarify how the 'global average pooling' operates on the input and why.**\n\nThanks for pointing out that Figure 3 may lack some details to fully grasp the architecture, especially with regard to global average pool operations. Let's break down the confusion and address the design choice. We will update the Figure 3 and related expression in the manuscript.\n\n1. **Clarifying Global Average Pooling**\n\nThe statement that global average pooling \"takes the two previous maxPool2D layers along with the output of the 2 by 2 max pooling\" is inaccurate. Here's how global average pooling actually works within this architecture:\n\nIndependent Operation: Global average pooling operates independently on each of the three convolutional pathways. It doesn't combine outputs from different stages.\n\nInput to Global Average Pooling: The input to the global average pooling layer in each pathway is solely the output of the last convolutional/pooling operation within that specific pathway. For instance:\n\nPathway 1: Input to global average pooling is the output from the 1-th MaxPool2D.\n\nPathway 2: Input to global average pooling is the output from the 2-th MaxPool2D.\n\nPathway 3: Input to global average pooling is the output from the 3-th Conv2D.\n\nMechanism: Global average pooling calculates the average value of each feature map independently. If a feature map at the input of global average pooling has dimensions H x W, it is reduced to a single scalar value representing the average across all H x W positions.\n\n2. **Design Choice Rationale**\n\nThe choice of using global average pooling in this manner is likely motivated by the following factors:\n\n**Integration of Multi-Scale Features:** Each convolutional pathway processes different receptive field sizes to extract features at various scales. For instance, paths that undergo multiple pooling layers can capture more global features, while paths with fewer pooling layers retain more local details.\n\nIntegrating the Global Average Pooling (GAP) results from each pathway is akin to merging information from different scales, resulting in a more comprehensive and enriched feature representation. This process facilitates the model in making more precise judgments.\n\n**Feature Summarization:** Global average pooling acts as a way to summarize the information present in each feature map into a single representative value. This is particularly useful for converting convolutional feature maps into a fixed-length vector, which is necessary for feeding into fully connected layers or for tasks like classification.\n\n**Regularization:** By reducing the number of parameters compared to using fully connected layers for this summarization, global average pooling can help prevent overfitting.\n\n**q6. Suggestions on how to improve the model.**\n\nWe thank the reviewer for this insightful suggestions. we agree that the linear layer also makes sense and will add this discussion to the limitation of the paper. Moreover, learning weightings on the frequencies is a promising research idea, considering that seizure patterns differ from normal patterns in the frequency domain. I will further explore this idea in the future. \n\n[1] C.G. Bénar, L. Chauvière, F. Bartolomei, F. Wendling,Pitfalls of high-pass filtering for detecting epileptic oscillations: A technical note on “false” ripples, Clinical Neurophysiology", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "zmaQZrvUWA", "reviewer": "Reviewer_NPyS", "summary": "The authors present an algorithms for subject-independent automatic seizure detection. the algorithm exploits the dynamic behavior of seizures by including a contextual region of analysis, and a channel reference, where contextual refer to the time window close to the window of analysis, and the channel reference to the long term average behavior of the signal. They propose to capture the differences in this dynamic behavior, in the frequency domain, in the Difference Matrix, which is then input in a CNN for its classification. The authors show the results for three different datasets, 2 public and one private, compared with different state of the art algorithms for seizure detection. They demonstrate that DMNet outperforms other algorithms.", "questions": "1. The channel-level reference also contain information of seizures, would it be possible to generate this reference pattern only for free of seizures segments? What is the possible impact of having information in this reference free of seizures, or containing seizures? Can you elaborate about this?\n2. Is a linear classifier good enough to discriminate between the latent representation Z, for normal and seizure segments? Did you also explore the use of other classifiers?.", "limitations": "None", "rating": 9, "confidence": 4, "soundness": 4, "presentation": 4, "contribution": 4, "strengths": "1. The propose a novel algorithm for independent-subject automatic seizure detection.\n2. They consider the use of dynamic information, and changes in this dynamic, in order to mitigate the effect of inter-subject variability. This is clever since the nature of the seizures is dynamic.\n3. They validate the algorithm in different datasets, and using different SOTA algorithms.\n4.", "weaknesses": "1. Can you indicate the sampling frequency of the signals analyzed? Also, you make the analysis based on number of samples, but I do believe this is dependent on the sampling frequency. For instance, if I evaluate the length of segment L for a signals sampled at 250Hz, or a signal sampled at 1KHz, the results with respect to performance metrics might be different. Can you elaborate a bit more about this? Will your algorithm work also for different sampling frequencies, or it should be fine tuned?\n\n\nminor:\n\n1. Can you improve the legibility of the figures, perhaps using a larger font in some cases and/or using alight font instead of a bold one in other cases. \n2. Line 85 use named or called, since namely is used to express the specific details of something but not to assign a name. \n3. I considere that the deployment of an online system should be listed as a separate contribution, since merging the third contribution with this mitigates negatively the impact of this item.\n4. Line 162, I think you refer to figure 2c and 2d, and not to figure 3.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "**w1: Discussion of the impact of different frequencies of data on the analysis and model performance.**\n\nWe thank the reviewer for this thoughtful question. The public dataset has the original sampling frequency of 5000Hz; then we downsample the data to 2500Hz. For the clinical dataset, the original sampling frequency varies from 512Hz to 1024Hz for different subjects (detailed descriptions in Table 3 in Appendix D); then we downsample the data to 250Hz (please refer to Appendix E, line 630).\n\nFor segments of the same length ($L$) but with different sampling frequencies (e.g., segment A with 250Hz **vs** segment B with 1000Hz), the frequency domain representation vector of segment A would have a smaller size than that of segment B due to the lower frequency resolution. This means that segment B can preserve richer neural activity information within the high-frequency range.\n\nOn the contrary, due to the same length of L, segment B would cover a shorter time duration than segment A, leading to limitations in capturing the long dependencies between seizure events and their contexts. To address this issue, a simple way is to increase the length of segment ($L$) for segment B so that it can cover a longer time duration.\n\nIf the model is directly applied to frequencies different from those in its training dataset, fine-tuning on the new frequency data is required. Another approach is to align the frequencies of the dataset for inference by upsampling or downsampling it to match the frequency of the training set, in which case fine-tuning is not necessary. However, there may be a performance penalty.\n\nIn our work, although the richer information in the high-frequency domain would yield better performance, it reduces algorithm efficiency. We argue that, compared to information within high-frequency bands, the duration that the reference segments cover is more important, as the long dependencies between seizure events and their contexts are essential to model the semantic information about the evolution of seizures. Therefore, as a trade-off between performance and efficiency, we uniformly downsample the original data.\n\n**w2: Minors**\n\nWe really appreciate the review for the careful reading and suggestions, and we'll make the modifications in our final version including:\n\n\\- Uniformly using a larger and alight font in cases.\n\n\\- Replacing \"namely\" with \"named\"  in Line 85.\n\n\\- Listing the deployment of an online system as a separate contribution.\n\n\\- Correcting the figure 2c and 2d referings in Section 3.2.\n\n**q1: Discussion on the effect of channel-reference including or not including seizures on model performance.**\n\nWe thank the reviewer for this insightful question. In our dataset, the ratio of seizure segments is very low, making the impact of included seizure segments during clustering for channel-level reference generation negligible. However, we agree that generating this reference pattern exclusively with normal segments would likely improve performance. Incorporating more seizure segments in the channel-level reference could result in a less distinguishable seizure pattern.\n\n**q2. Discussion about the classifier in DMNet.**\n\nWe thank the reviewer for this insightful question. Unfortunately, the linear classifier may not suffice to discriminate the seizure events since the generated representation of difference matrix would contain the non-lieanr patterns (Please refer to Figure 8 in Appendix for a more detailed presentation).", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}]

Author rebuttal:
# Global Response

**GR1. Clarify why reverse the L_cl to form R_cl and concatenate it on the right.**

The additional L_cl (reversed segments of R_cl) enables some originally different seizure sequences to generate similar difference matrix after fully differencing operation, which further enhance the generalization of seizure patterns. A example is provided below to illustrate this point: 

Let XY denotes the left channel-reference (L_cl) and YX be the reversed segments as the right. Now  we  consider  two sequences following: 00111 and  11100,  where  0 and 1 represent normal and seizure  events.  Then we  concatenate  the  channel-reference  to  these two  sequences  and  performing  differencing, the results  are  shown  below:

XY00111: 
$$ \left[  \begin{matrix} 
0&X-Y&X&X&X-1&X-1&X-1\\\\
Y-X&0&Y&Y&Y-1&Y-1&Y-1\\\\
-X&-Y&0&0&-1&-1&-1\\\\
-X&-Y&0&0&-1&-1&-1\\\\ 
1-X&1-Y&-1&-1&0&0&0\\\\ 
1-X&1-Y&-1&-1&0&0&0\\\\ 
1-X&1-Y&-1&-1&0&0&0\\\\ 
\end{matrix}  \right]  \tag{1} $$


XY11100: 
$$\left[  \begin{matrix} 
0&X-Y&X-1&X-1&X-1&X&X\\\\ 
Y-X&0&Y-1&Y-1&Y-1&Y&Y\\\\ 
1-X&1-Y&0&0&0&1&1\\\\ 
1-X&1-Y&0&0&0&1&1\\\\ 
1-X&1-Y&0&0&0&1&1\\\\ 
-X&-Y&-1&-1&-1&0&0\\\\ 
-X&-Y&-1&-1&-1&0&0\\\\ 
\end{matrix}  \right]  \tag{2}$$
XY00111YX: 
$$\left[  \begin{matrix} 
0&X-Y&X&X&X-1&X-1&X-1&X-Y&0\\\\ 
Y-X&0&Y&Y&Y-1&Y-1&Y-1&0&Y-X\\\\ 
-X&-Y&0&0&-1&-1&-1&-Y&-X\\\\ 
-X&-Y&0&0&-1&-1&-1&-Y&-X\\\\ 
1-X&1-Y&-1&-1&0&0&0&1-Y&1-X\\\\ 
1-X&1-Y&-1&-1&0&0&0&1-Y&1-X\\\\ 
1-X&1-Y&-1&-1&0&0&0&1-Y&1-X\\\\ 
Y-X&0&Y&Y&Y-1&Y-1&Y-1&0&Y-X\\\\ 
0&X-Y&X&X&X-1&X-1&X-1&X-Y&0\\\\ 
\end{matrix}  \right]  \tag{3}$$

XY11100YX: 
$$\left[  \begin{matrix} 
0&X-Y&X-1&X-1&X-1&X&X&X-Y&0\\\\ 
Y-X&0&Y-1&Y-1&Y-1&Y&Y&0&Y-X\\\\ 
1-X&1-Y&0&0&0&1&1&1-Y&1-X\\\\ 
1-X&1-Y&0&0&0&1&1&1-Y&1-X\\\\ 
1-X&1-Y&0&0&0&1&1&1-Y&1-X\\\\ 
-X&-Y&-1&-1&-1&0&0&-Y&-X\\\\ 
-X&-Y&-1&-1&-1&0&0&-Y&-X\\\\ 
Y-X&0&Y-1&Y-1&Y-1&Y&Y&0&Y-X\\\\
0&X-Y&X-1&X-1&X-1&X&X&X-Y&0\\\\ 
\end{matrix}  \right]  \tag{4}$$

As we can see, for the difference matrices with channel-reference concatenated at both sides (i.e., XY00111YX, XY11100YX), they present the very similar pattern, that is, matrix (4) is exactly the result by rotating the matrix (3) clockwise 180 degrees. Since we encode the difference matrix using CNNs, which have translation invariance and rotation invariance[1]. Thus these two matrices would be infered as the same property by CNNs, leading to a more generalized seizure pattern. In contrast, the former two segments (XY00111, XY11100) without reversed right channel-reference (R_cl) involved, their difference matrices (1,2) cannot be obtained from each other by translation or rotation, which increases the burden of model learning.

**GR2. Clarify the data division and the hyperparameters selection.**

**Data Division.** We conducted experiments on one clinical dataset and two public datasets. To perform experiments in a domain generalization setting, we grouped subjects within each dataset and then constructed different folds. Each fold comprised a training set, a validation set, and a test set, each consisting of one or multiple groups. For detailed experiment setup, please refer to Appendix-D.

**Hyperparameter Selection.** Our hyperparameter selection was not based on results from the test set. The model underwent evaluation using Leave-one-domain-out validation [2] with grid search. We opted for hyperparameters that maximize the average F1 score across the held-out domains in all folds. The hyperparameter search scope is as follows.

| Hyperparameter     | Search Scope                                                 |
| ------------------ | ------------------------------------------------------------ |
| Length of Segment  | Clinical:{100, 150, 200, 250,300} Public:{300, 400, 500, 600, 700} |
| Number of Segment  | {8, 9, 10, 11, 12}                                           |
| Number of Cluster  | {6, 8, 10, 12}                                               |
| Base filter Number | {8, 16, 32, 64, 128}                                         |
| Learning Rate      | {1e-4, 3e-4, 5e-4, 1e-3, 3e-3}                               |
| Batch Size         | {8, 24, 32, 40}                                              |

**GR3. Discuss the empirical and theoretical supports of DMNet.**

Basically, the design of our proposed DMNet is motivated by both neuroscience discoveries and our empirical analyses.

**Neuroscience Basis.** Although there is domain shift among different subjects and even within the same subject at different times, seizure events consistently show a higher average amplitude in the frequency domain compared to their background signal. This discovery aligns with previous research in the field [3].

**Empirical Analysis.** Building on this, we propose a self-comparison mechanism that compares the target segment with its adjacent normal segment to reduce domain shifts between subjects and time intervals. Our preliminary analysis in Section 3 reveals that using a subtraction operation in the frequency domain for self-comparison effectively reduces domain shifts while enhancing the discriminability of seizures from normal events. The success of this self-comparison method may stem from the fact that subtraction-based comparison is a relative concept, capable of mitigating data scale discrepancies while explicitly highlighting the differences between seizure and normal events. 

We appreciate reviewers' constructive comments regarding the lack of theoretical support. Up to the present, why the difference matrix is able to reduce the distribution shift between subjects remains an open question, and we'll leave as our future work.

[1]Zeiler, el.. Visualizing and Understanding Convolutional Networks.

[2]Gulrajani I, el. In Search of Lost Domain Generalization[C] International Conference on Learning Representations.

[3]Catherine el. Evidence of an inhibitory restraint of seizure activity in humans. Nature communications, 2012.

Meta-review: The authors present Difference Matrix-based Neural Network for subject-independent automatic seizure detection. The model addresses the domain shift in iEEG signals across different subjects by leveraging a self-comparison mechanism that can enhance the model's ability to perform effectively across new subjects without additional training. The approach is novel and well presented. Several concerns on empirical evaluation and hyper-parameter selection process are well addressed by the additional experiments and explanations in the authors' rebuttal.
Decision: Accept (poster)