Introduction

Epilepsy is a neurological disorder in which transient alteration of brain functions due to hyperexcitable neurons and their network causes seizures1,2. Patients with epilepsy suffer from recurrent paroxysmal symptoms, such as loss of consciousness, tonic‒clonic seizures, and behavioral changes3, as well as persistent comorbidities, such as depression and anxiety. Thus, epilepsy is a highly burdensome disease. The causes of epilepsy include nutritional status during pregnancy, complications during childbirth, head injury, exposure to toxic substances, brain infections, tumors, strokes, and degenerative changes in the brain4,5,6.

Antiseizure medication (ASM) is an initial option and the mainstay in epilepsy treatment7. While more than 30 ASMs have been developed and utilized8, approximately one-third of epilepsy patients are still medically refractory9,10,11. Among medically refractory patients, surgically remediable patients undergo resection of the seizure focus area. The International League Against Epilepsy (ILAE) defines medically refractory epilepsy as the persistence of seizures even after adequate trials of two ASMs12. However, given the paucity of information regarding seizures induced by cognitive problems, nocturnal seizures, and amnesia after seizures13, more objective and commonly utilized tools (such as EEG) are needed. Although EEG is used to diagnose and assess clinical status14, conventional visual readings of EEG recordings might be insufficient for evaluating brain status, especially for determining future outcomes.

More than 60% of newly diagnosed epilepsy patients enter long-term remission; therefore, predicting the outcome of epilepsy is crucial not only for patients but also for their families10. Additionally, predicting outcomes in epilepsy is essential for providing feedback that can lead to improved outcomes15.

Accordingly, many recent machine learning (ML) studies have used resting-state EEG data to predict the long-term outcomes (i.e., seizure-free (SF) or non-seizure-free (NSF)) of ASM treatment. These data can be used as a tool to characterize the neurophysiological effects of ASMs in epilepsy patients. Zhang et al.16 proposed a prediction model that used sample entropy and a support vector machine (SVM) to predict the attainment of SF status in epilepsy patients treated with levetiracetam (LEV). Croce et al.17 used a partial least square regression with standard deviation as a feature. Ricci et al.18 employed the power spectral density and phase locking value to measure brain activity and connectivity. These three studies were conducted among epilepsy patients who received LEV as their first ASM. Additionally, Lanzone et al.19 examined the effect of perampanel in patients with focal epilepsy. Notably, all these studies focused on spectral analysis of the delta (0.5–4 Hz), theta (4–7.5 Hz), alpha (7.5–12 Hz), beta (12–30 Hz), and gamma (30–60 Hz) bands; this method is called pharmaco-EEG20 and involves the quantitative analysis of the EEG data to document the effect of drugs. However, more specific frequency bands should be investigated to optimize the predictive performance of the model21. In addition to spectral analysis, temporal analysis should also be performed22,23,24. Moreover, the optimal features should be explored16. From a clinical perspective, the prediction of outcomes should be performed for individuals undergoing both polytherapy and monotherapy, as polytherapy users account for approximately one-third of all epilepsy patients25. Furthermore, predictions in the context of monotherapy, especially for one type of drug, do not reflect real-world practice.

In the present study, we adopted ML classifiers to predict patient outcomes and to identify the optimal spectral and temporal features. We implemented the random forest (RF)26 model in the main experiment, while linear discriminant analysis (LDA)27, XGBoost (XGB)28, and CatBOFTSoost (CATB)29 were used for the additional experiment.

The goal of this study was to use resting-state EEG signals to determine whether spectral and temporal filters can be used to predict the outcomes of patients with temporal lobe epilepsy (TLE), which is the most common type of focal epilepsy. Four different analysis strategies were designed with various time-domain features: the optimal frequency strategy (OFS), optimal time strategy (OTS), optimal frequency and time strategy (OFTS), and no strategy (NS). Finally, some interpretations of the experimental results were provided based on established theories.

Results

Comparison of the effects of the analysis strategies

The effect of each analysis strategy was compared based on the classification performance of all feature groups combined (Fig. 1A) and each feature group separately (Fig. 1B). The box plot of the area under the receiver operating characteristic curve (AUC) values for each analysis strategy shows that the OFTS strategy had significantly higher AUC values (0.790 ± 0.159) than the OTS strategy (0.631 ± 0.170, \(p_{OFTS - OTS} \; < \;0.001,\;{{ {\text Cliff}^{\prime}s }}\;{\text{delta}}_{OFTS - OTS} \; = \;0.526)\), the OFS strategy (0.629 ± 0.160, \(p_{OFTS - OFS} \; < \;0.001,{ }\;{{{\text Cliff}^{\prime}s }}\;{\text{delta}}_{OFTS - OFS} \; = \;0.507\)) and NS (0.575 ± 0.174, \(p_{OFTS - NS} \; < \;0.001,{ }\;{{{\text Cliff}^{\prime}s}}\;{\text{ delta}}_{OFTS - NS} \; = \;0.611\)\()\). The bar charts show that the AUC of each feature group under the OFTS strategy was higher than that under the other strategies.

Figure 1
figure 1

Comparative Analysis of AUC Values Across Different Analysis Strategies and Features. (A) Boxplot representation showing the aggregate AUC values for each analysis strategy. This part of the figure combines results from distinct nine feature groups, with each strategy displaying 45 data points. These points represent the AUC values obtained from fivefold cross-validation for each of the feature groups, thereby illustrating the collective performance across multiple validation scenarios. (B) Bar charts depicting the AUC values for each individual feature under the different analysis strategies. The chart provides a feature-specific comparison, illustrating how each feature group contributes to the overall efficacy of the strategies.

Comparison of the performance of time-domain features

The classification performance of each time-domain feature under the OFTS strategy is presented in Table 1. Feature group F yielded the best AUC (0.838 ± 0.204), and Feature group B yielded the best accuracy (ACC; 0.824 ± 0.135), as shown in Table 1. Since Feature group B showed the highest performance on all metrics except for the AUC, Feature group B was evaluated with various ML classifiers. In this experiment, XGB showed the highest performance (AUC: 0.765 ± 0.179, ACC: 0.827 ± 0.112) on all metrics except for the true negative rate (TNR), positive predictive value (PPV), and negative predictive value (NPV). Detailed information about these analyses is provided in Supplementary Table 1.

Table 1 The classification performance of each time-domain feature under the optimal frequency and time strategy.

Comparison of the major feature values between SF and NSF patients

Figure 2A shows topology plots demonstrating the ability of Feature group B (statistical parameters) to distinguish between the SF and NSF groups. The kurtosis and maximum value were extracted from the EEG signals of all TLE patients (SF group: 22 patients, NSF group: 24 patients), and the EEG channel-wise average of patients was used to obtain the kurtosis and maximum value. Among the statistical parameters for Feature group B, the kurtosis and maximum value were selected since the values showed significant differences between the SF and NSF groups (\(p_{kurtosis} = 0.002\), \({{{\text Cliff}^{\prime}s delta}}_{Kurtosis} = 0.576\), \(p_{max} < 0.001,{ }\;\;{{ {\text Cliff}^{\prime}s delta}}_{max} = 0.570\)) (Fig. 2B, C). The patterns of the topology plots were compared quantitatively using cosine similarity (CS)30 and Euclidean distance (ED)31. For kurtosis, compared with NS, the OTS strategy showed a slight increase in CS (\({\text{CS}}_{OTS - NS} = 0.013\)) and ED (\(ED_{OTS - NS} = 0.342\)), but the OFS strategy showed an increase in CS (\({\text{CS}}_{OFS - NS} = 0.169\)) and a decrease in ED (\({\text{ED}}_{OFS - NS} = - \;0.023\)). The OFTS strategy yielded the highest ED (4.929), with a CS (0.936) close to 1. At the maximum value, all strategies yielded CS values close to 1. Furthermore, ED was lower under the OTS strategy (\(ED_{OTS - NS} = - \;0.212\)) and higher under the OFS strategy (\(ED_{OFS - NS} = 2.199\)) than under NS. The OFTS strategy yielded the highest ED (5.935), similar to the findings for kurtosis (Supplementary Table 2).

Figure 2
figure 2

(A) Topology plots for each analysis strategy using the kurtosis and maximum value of Feature 2. Each topology plot consisted of the average value of each group (seizure-free (SF) or non-seizure-free (NSF)). (B, C) Comparison of SF vs. NSF groups according to the kurtosis (B) and the maximum value (C) under OFTS for each patient. For each patient's kurtosis and maximum values in (B, C), the average for all EEG channels was used. Asterisks indicate that the p value is less than 0.05.

Optimal EEG window length and optimal frequency band of the EEG signals for SF prediction

Figure 3A and B show the variance in predictive performance based on the window length of the resting-state EEG signal (average AUC of the four features at each window length is shown in Fig. 3A, the AUC of Feature group B at each window length is shown in Fig. 3B). As shown in Fig. 3A, the highest AUC of the four features at each window length was observed at 210 s (0.673 ± 0.076); this value was significantly different from that at other window lengths except 120, 150, 180, 240, and 270 s. As shown in Fig. 3B, the highest AUC of Feature group B at each window length was observed at 150 s (0.838 ± 0.102); this value was significantly different from that at almost all other window lengths. Detailed information regarding these analyses is shown in Supplementary Table 3. Figure 3C shows the AUC of each frequency band at the optimal EEG window length for Feature 2. The highest AUC in the low gamma band (frequency band of 39–41 Hz) was 0.748 ± 0.163, and the AUC showed a tendency to increase from the low-frequency band to the high-frequency band. In particular, it was found that the high beta (beta 3; AUC = 0.645 ± 0.050) and low gamma bands (AUC = 0.668 ± 0.057) showed better performance than the other frequency bands (delta: AUC = 0.522 ± 0.005, theta: AUC = 0.520 ± 0.100. alpha: AUC = 0.509 ± 0.131, beta1: AUC = 0.600 ± 0.047, beta2: AUC = 0.525 ± 0.085).

Figure 3
figure 3

(A) Average performance (AUC) for all feature groups with each EEG window length on the optimal frequency band. Asterisks indicate that the p value is lower than 0.05 compared with the AUC at 270 s. (B) Performance (AUC) of Feature 2 on the optimal frequency band at each EEG window length. Asterisks indicate that the p value is lower than 0.05 compared with the AUC at 150 s. (C) Performance (AUC) of Feature 2 at the optimal EEG window length for each frequency band. The frequency range of each band is as follows: delta band, 0.1–4 Hz; theta band, 4–8 Hz; alpha band, 8–12 Hz; beta1 (low beta) band, 12–16 Hz; beta2 (beta) band, 16–20 Hz; beta3 (high beta) band, 20–30 Hz; and low gamma band, 30–50 Hz. The asterisk indicates the frequency band with the highest performance.

Discussion

In this study, we showed the effects of using spectral and temporal filters on the prediction of outcomes among patients with TLE. Our main findings are as follows. (1) When predicting the outcome of TLE patients using resting-state EEG signals, simultaneously optimizing the spectral and temporal ranges greatly improved performance. (2) When the EEG window length is greater than 2 min, using the gamma band and statistical parameters (especially the kurtosis and the maximum value) as features had a substantial impact on the prediction performance.

Synergy of spectral and temporal filters

We evaluated the use of each analysis strategy to compare and investigate the effect of spectral and temporal filters on prediction performance. When only one filter (spectral or temporal) was optimized, the performance was increased compared to the scenario in which no filer is optimized; however, the performance was further improved when both filters were optimized (Fig. 1). These results suggest that spectral and temporal filters must be used together to achieve a significant increase in performance, especially when using long-term EEG signals such as resting-state EEG. Additionally, we quantitatively compared the topology plot of each analysis strategy in terms of CS and ED, which represent the similarity of spatial patterns and the difference between the patterns, respectively. When the spectral filter was optimized, the CS between the two groups (SF and NSF) increased, which means that these groups had similar spatial patterns. The temporal filter seemed to be related to ED, indicating an increase in the intensity of the patterns; ED increased substantially when the spectral filter was applied. These results also show that synergy in the similarities of spatial patterns (CS and ED) occurs when the spectral and temporal filters are optimized simultaneously (Supplementary Table 2).

Appropriate optimal EEG window length and EEG frequency band for SF prediction

As shown in Fig. 3A and B, we found that increasing the window length of the resting-state EEG signals to greater than 2 min led to a significant improvement in performance. We believe that the discriminative power of features could (1) exist in a specific section of the EEG signals or (2) occur over a specific length of EEG signals (or both). As resting-state EEG involves no specific stimulus or action32, it is expected that the discriminative power of features would occur over a specific length of time rather than in a specific section.

As shown in Fig. 3C, we compared the SF prediction performances within narrow frequency bands. The use of the low gamma band (30–50 Hz) with Feature 2 (statistical parameters) led to a higher predictive value.

Strengthening or weakening of cognitive function is one of the side effects of ASM treatment, which is secondary to the intended purpose of seizure control33,34,35. Although it is well known that long-term treatment with ASMs can adversely affect cognitive functions, such as attention, vigilance, and psychomotor speed36,37, some ASMs (e.g., carbamazepine, lamotrigine, valproate) have positive psychotropic effects38.

EEG modulation in the gamma band (> 30 Hz), has been shown to be correlated with large-scale brain network activity39. In particular, modulation in this band is known to play a crucial role in cognitive processes (e.g., working memory, attention, and perceptual grouping) and is thus assumed to reflect the consciousness level40,41.

Additionally, the EEG modulation in the gamma band was reflected in the kurtosis and the maximum value. One phenomenon—namely, sharp wave ripples—may account for the processes assessed by kurtosis and maximum values. Sharp wave ripples, which support the consolidation of recently acquired memories or the planning of future actions, consist of several spectral components: a slow sharp wave (5–15 Hz), a high-frequency “ripple” oscillation (150–200 Hz), and a slow “gamma” oscillation (20–40 Hz). The fusion of sharp wave ripples could also be reflected as increased power in the slow gamma band42. These prior findings lend credibility to our results with respect to the importance of low gamma and Feature 2.

Limitations and future work

Our study has several limitations. First, our analysis was based on individual EEG segments for each patient. We only drew segments once for all window lengths because we were comparing performance across window lengths, and thus, we suspected that having different numbers of epochs for different window lengths might affect the results. The use of only one segment per patient might not fully capture the variability inherent in EEG signals. This approach may limit the generalizability of our findings, as multiple segments could provide a more comprehensive view of each patient's EEG characteristics. Second, the highest frequency bands that can be observed through scalp EEG signals are only approximately 50 Hz43. Therefore, it is necessary to investigate frequency ranges higher than 50 Hz through another modality through an additional method. Third, most patients were already taking ASMs at the time of the EEG study. Fourth, because the dataset used in this study consisted of patients receiving mono- or polytherapy, it is difficult to characterize the effect of a particular ASM on the EEG signal. Finally, this retrospective study was conducted using a limited dataset, which could introduce bias in the characteristics of epilepsy patients. Future research should apply more sophisticated methods that can aggregate multiple frequency bands and multiple time segments using resting-state EEG signals.

Conclusion

This study shows that the application of spectral and temporal filters to resting-state EEG signals enhanced the prediction of long-term patient outcomes when the spectral and temporal filters were simultaneously optimized. In particular, an EEG window length of greater than 2 min and the gamma band substantially impacted the prediction performance. This optimization strategy can be applied for the early identification of patients with drug-resistant epilepsy, as they are potential candidates for nonpharmacologic intervention.

Materials and methods

Patients and data collection

We retrospectively analyzed the medical records and EEG data of patients with TLE who visited Seoul National University Hospital between 2014 and 2021. All included patients had experienced at least one clinical seizure and were confirmed as having TLE based on seizure semiology, EEG, and/or 3.0-Tesla magnetic resonance imaging throughout the follow-up period. All patients received ASM during the follow-up period. We included patients whose initial EEG data were obtained using the NicoletOne® EEG system (Natus, San Carlo, CA, USA). Demographic and clinical characteristics, including baseline and final seizure frequencies, were obtained through a retrospective review of medical records. A total of 46 patients with TLE were selected and divided into two groups according to the final outcome: the SF group (seizure-free for the last year of follow-up, n = 22) and the NSF group (at least one seizure in the last year of follow-up, n = 24). In our capacity as a tertiary referral hospital, we identified only one treatment-naïve patient with TLE, while all other patients were already using ASMs at the time of EEG study. None of the patients had undergone ketogenic diet therapy. This study was conducted in accordance with the Declaration of Helsinki. This study was approved by the Institutional Review Board of Seoul National University Hospital (IRB No. H-2109-005-1251), and the need for informed consent was waived by the Institutional Review Board of Seoul National University Hospital due to the retrospective nature of the study. Detailed patient information can be found in Table 2.

Table 2 Demographic and clinical characteristics of the seizure-free and non-seizure-free groups.

EEG recording

All EEG data were acquired with the NicoletOne® EEG system using the modified international 10–20 electrode placement system (electrodes: Fp1, Fp2, T1, F7, F3, Fz, F4, F8, T2, T3, C3, Cz, C4, T4, T5, P3, Pz, P4, T6, O1, and O2), with a sampling rate of 250 Hz, a hardware high-pass filter of 0.1 Hz, and a hardware low-pass filter of 500 Hz. All electrode impedances were maintained below 10 kΩ. After photic stimulation and hyperventilation, the patients were asked to close their eyes to collect resting-state EEG data. The first 5 min of resting-state EEG data were processed for further analysis. Among the participants, 1 out of 22 SF patients (4.5%) and 4 out of 24 NSF patients (16.7%) exhibited interictal epileptiform discharges within the first 5 min of EEG recordings (p = 0.349).

Preprocessing

The resting-state EEG signals, recorded from 20 to 320 s, were epoched and then scaled by 106 to convert the measurements from volts to microvolts (µV), thus enhancing both the relevance and clarity of the data44. Data from all 21 channels were used in further analysis. However, data referencing was conducted only with the following EEG channels: F3, Fz, F4, C3, Cz, C4, P3, Pz, P4, O1, and O245.

Analysis strategy

To determine the effect of appropriate spectral and temporal ranges in predicting SF outcomes of TLE patients, the following three strategies were compared. (1) In the OTS strategy, a grid search was applied to optimize the temporal range of the EEG signals in a fixed frequency band (0.1–51 Hz). The temporal segments were extracted only once with different durations. All segments started precisely at the 0-s mark of the resting-state EEG data. The target temporal range was set at 1-s intervals from 1 to 30 s and 30-s intervals from 30 to 300 s (thus yielding a total of 39 temporal segments, 1, 2, 3, …, 27, 28, 29, 30, 60, …, 90, 120, 150, …, 300 s). (2) In the OFS strategy, a grid search was applied to optimize the spectral range of EEG signals from 0.1 Hz (low cut) to 2 Hz (high cut) up to 49 Hz (low cut) to 51 Hz (high cut) (a total of 50 bands spanning 2 Hz) for the total resting state (300 s). (3) In the OFTS strategy, a two-grid search was applied to 50 spectral and 39 temporal ranges to optimize the spectral and temporal ranges simultaneously. Then, bandpass filtering, standardization46 and segmentation were sequentially performed. Figure 4 shows the analysis pipeline for OFTS. In the case of NS, total resting state (300 s) and fixed-frequency bandpass cutoff from 0.1 Hz (low cut) to 51 Hz (high cut) were applied.

Figure 4
figure 4

Analysis strategy for determining the optimal spectral and temporal range.

Feature extraction

Among the many EEG features, four types of features were selected based on the following three questions (1) Is it a time-domain feature? (The analysis pipeline included a narrow bandpass filter). (2) Has it ever been used in an EEG-based epilepsy study? (3) What is the computational cost? (Supplementary Table 4). The selected features were as follows: Hjorth parameters (Feature group A), statistical parameters (Feature group B), energy (Feature group C), zero-crossing rate (Feature group D), interchannel correlation (ICC) (Feature group E), interchannel phase locking value (ICPLV) (Feature group F), spectral power (Feature group G), Stockwell transform (ST) (Feature group H), and wavelet transform (WT) (Feature group I).

Hjorth parameters (Feature group A)

Hjorth parameters consist of activity, mobility, and complexity, which represent the signal power, mean frequency, and change in frequency, respectively47. In many epilepsy studies, these parameters have been used to detect and diagnose seizures48,49 or to predict seizure recurrence after ASM withdrawal50. A total of 63 Hjorth parameters were acquired using Eqs. (1)–(3) and used as ML inputs.

$$ {\text{Activity}}\left( {\text{X}} \right) = {\text{var}}\left( {{\text{X}}\left( {\text{t}} \right)} \right) $$
(1)
$$ {\text{Mobility}} = \frac{{\sqrt {{\text{var}}\left( {{{{\text X}^{\prime}}}\left( {\text{t}} \right)} \right)} }}{{\sqrt {{\text{var}}\left( {{\text{X}}\left( {\text{t}} \right)} \right)} }} $$
(2)
$$ {\text{Complexity}} = \frac{{\sqrt {{\text{var}}\left( {{{{\text X}^{\prime\prime}}}\left( {\text{t}} \right)} \right)} /\sqrt {{\text{var}}\left( {{{{\text X}^{\prime}}}\left( {\text{t}} \right)} \right)} }}{{\sqrt {{\text{var}}\left( {{{{\text X}^{\prime}}}\left( {\text{t}} \right)} \right)} /\sqrt {{\text{var}}\left( {{\text{X}}\left( {\text{t}} \right)} \right)} }} $$
(3)

Statistical parameters (Feature group B)

In many EEG-based epilepsy studies, statistical parameters have been used as features to detect seizures51, distinguish healthy participants from epilepsy patients52 and predict LEV treatment responses17,51. We selected six of the most commonly used statistical indicators (i.e., skewness, kurtosis, and the mean, median, minimum, and maximum values) as Feature group B. Variance, which is one of the most commonly used statistical indicators, was excluded from Feature group B because it was included in Feature group A (Hjorth parameters). A total of 126 statistical parameters were acquired using Eqs. (4)–(9) and used as ML inputs.

$$ {\text{Skewness}}\left( {\text{X}} \right) = {\text{E}}\left[ {\left( {\frac{X\left( t \right) - \mu }{\sigma }} \right)^{3} } \right], $$
(4)
$$ {\text{Kurtosis}}\left( {\text{X}} \right) = {\text{E}}\left[ {\left( {\frac{X\left( t \right) - \mu }{\sigma }} \right)^{4} } \right] $$
(5)
$$ {\text{Mean}}\left( {\text{X}} \right) = \frac{1}{n}\mathop \sum \limits_{t = 1}^{n} X\left( t \right) $$
(6)
$$ {\text{Median}}\left( {\text{X}} \right) = \left\{ {\begin{array}{*{20}l} {X\left( {\left( {t + 1} \right)/2} \right)} \hfill & { if\; t\; is\; odd} \hfill \\ {\left( {X\left( \frac{t}{2} \right) + X\left( {\frac{t}{2} + 1} \right)} \right)/2} \hfill & {if\; t\; is\; even} \hfill \\ \end{array} } \right. $$
(7)
$$ {\text{Min}}\left( {\text{X}} \right) = X\left( {t_{0} } \right),\;\; if\left( {\forall {\text{t}} \in {\text{T}}} \right) X\left( {t_{0} } \right) \le X\left( t \right) $$
(8)
$$ {\text{Max}}\left( {\text{X}} \right) = X\left( {t_{0} } \right),\;\; if\left( {\forall {\text{t}} \in {\text{T}}} \right) X\left( {t_{0} } \right) \ge X\left( t \right) $$
(9)

Energy (Feature group C)

Many studies have used energy as an indicator of brain activity18,19. Therefore, the linear and nonlinear energy of the EEG signals were included in Feature group C52. A total of 42 energy parameters were acquired using Eqs. (10), (11) and used as ML inputs.

$$ Energy_{Linear} \left( {\text{X}} \right) = \frac{1}{n}\mathop \sum \limits_{t = 1}^{n} X\left( t \right)*X\left( t \right) $$
(10)
$$ Energy_{Non - linear} \left( {\text{X}} \right) = \frac{1}{n - 2}\left( {\mathop \sum \limits_{t = 2}^{n - 1} X\left( t \right)*X\left( t \right) - \mathop \sum \limits_{t = 3}^{n} X\left( t \right)*X\left( t \right)} \right) $$
(11)

Zero-crossing rate (Feature group D)

The zero-crossing rate is the rate at which a signal changes from positive to zero to negative or from negative to zero to positive53. This parameter has been used to detect or classify seizures from normal EEG signals in many studies54,55. In this study, the zero-crossing rate and its first derivative were included in Feature group D52. A total of 42 zero-crossing parameters were acquired using Eqs. (12), (13) and used as ML inputs.

$$ {\text{Zero}} - {\text{crossing rate }}\left( {\text{X}} \right) = \frac{1}{2}\mathop \sum \limits_{t = 2}^{n} \left| {sign(X\left( t \right) - sign(X\left( {t - 1} \right)} \right| $$
(12)
$$ {\text{Zero}} - {\text{crossing}}_{derivative} \left( {\text{X}} \right) = \frac{1}{2}\mathop \sum \limits_{t = 2}^{n} \left| {sign(X^{\prime}\left( t \right) - sign(X^{\prime}\left( {t - 1} \right)} \right| $$
(13)

ICC (Feature group E)

In the context of EEG analysis, cross-correlation is a powerful tool56,57 that offers unique insights into the functional connectivity and relationships between different brain regions. We used the Pearson correlation coefficient as the correlation coefficient in Eq. (14), which is a measure of the linear correlation between two variables X and Y. A total of 210 ICC were acquired using Eq. (14) and 20 graph measurements23,58 were used as ML inputs. Graph measurements were performed using NetworkX59 and nilearn60 Python libraries.

$$ {\text{Inter}} - {\text{channel}}_{correalation} \left( {{\text{X}},{\text{Y}}} \right) = \frac{{\mathop \sum \nolimits_{t = 1}^{T} \left( {X\left( t \right) - \overline{X}} \right)\left( {Y\left( t \right) - \overline{Y}} \right)}}{{\sqrt {\mathop \sum \nolimits_{t = 1}^{T} \left( {X\left( t \right) - \overline{X}} \right)^{2} \left( {Y\left( t \right) - \overline{Y}} \right)^{2} } }} $$
(14)

ICPLV (Feature group F)

In the context of EEG analysis, ICPLV is a powerful tool for investigating phase synchronization between brain regions. Its ability to provide insights into the timing and coordination of brain activities makes it invaluable in both research and clinical settings61,62. A total of 210 ICPLVs were acquired using Eq. (15), and 20 graph measurements23,58 were used as ML inputs.

$$ {\text{Inter}} - {\text{channel}}_{plv} \left( {{\text{X}},{\text{Y}}} \right) = \left| {\frac{1}{{\text{T}}}\mathop \sum \limits_{t = 1}^{T} e^{{i\left( {\emptyset_{X\left( t \right)} - \emptyset_{Y\left( t \right)} } \right)}} } \right| $$
(15)

Spectral parameters (Feature group G)

Spectral power and phase, which are acquired using fast Fourier transform (FFT) (Eq. 16), are crucial components of EEG signal analysis, These parameters provide deep insights into brain function and neural activity.63,64 We extracted five spectral parameters: mean, median, minimum, maximum, skewness and standard deviation of power and phase. A total of 126 spectral parameters were acquired using Eq. (16) and used as ML inputs.

$$ Spectral - power\left( {\text{X}} \right) = \mathop \sum \limits_{t = 1}^{T - 1} X\left( t \right)*e^{{\frac{i2\pi }{T}kt}} $$
(16)

ST parameters (Feature group H)

The ST is a linear transform that combines elements of the wavelet transform and the Fourier transform. It provides a time–frequency representation of a signal, similar to the wavelet transform, but it exhibits properties more akin to the Fourier transform65,66. We extracted five ST parameters mean, median, minimum, maximum, skewness and standard deviation. The stockwell python package was used to estimate ST. A total of 126 ST parameters were used as ML inputs.

WT (Feature group I)

Wavelet coefficients derives from the application of a wavelet transform to a signal. The wavelet transform decomposes the signal into components that vary in both time and frequency, unlike the Fourier transform, which only provides frequency information67,68. The wavelet coefficient of the continuous wavelet transform was acquired using the pywt.cwt function in Python (‘wavelet = db4’)69. We extracted five wavelet coefficient parameters: mean, median, minimum, maximum, skewness and standard deviation of square of absolute values of WT. A total of 126 WT parameters were used as ML inputs.

Classification and statistical analysis

The classification was performed using the RF model26 in the main experiment, and LDA27, XGB28, and CATB29 were used for the additional experiment. We treated each EEG channel as a separate input and only used a single segment of the temporal range. The area under the receiver operating characteristic curve, accuracy, F1 score, true positive rate, true negative rate, positive predictive value, and negative predictive value for each feature were compared through five-fold nested cross-validation with grid search, in which the number of patients in the test dataset was 9 or 10. The hyperparameter of each fold of each model was set based on grid-search (Supplementary Table 5). The Mann‒Whitney U test and Cliff’s delta were used for all statistical analyses, including the comparison of each feature’s performance.

Conflict of interest/ethical publication statement

None of the authors has any conflict of interest to disclose. We confirm that we have read the Journal’s position on issues involved in ethical publication and affirm that this report is consistent with those guidelines. This study was approved by the Institutional Review Board of Seoul National University Hospital (IRB No. H-2102-178-1200), and the need for informed consent was waived because of the retrospective design.