## 3 Materials and Methods
### Encoder  
#### 3.1.1 Time Frequency Feature Fusion for EEG Graph Structure  
To enable the graph attention autoencoder to learn deeper graph embedding representations, we initially transform EEG signals into a specialized graph structure. This step aims to adapt to the Laplacian-enhanced graph attention autoencoder, ensuring the EEG signal characteristics can be effectively understood and utilized by the encoder. To enrich the feature representation of nodes, we fuse the original time domain features and frequency domain features of EEG signals to constitute the node's feature representation.  
Each EEG signal is processed and converted into a graph structure \(A\) with rich features \(Z\), including:  
(1) Node: Each EEG channel serves as a node in the graph, and the node's feature, denoted by \(Z\), is derived by integrating a segment of the original EEG time series signal with frequency domain features calculated from the same segment. Frequency domain features are obtained through the Fast Fourier Transform (FFT) that computes the power spectral density, band power, and peak frequency for the \(\delta\) (0.5-4 Hz), \(\theta\) (4-8 Hz), \(\alpha\) (8-13 Hz), and \(\beta\) (13-30 Hz) bands.  
These frequency attributes are carefully chosen because they disclose vital details of the frequency domain pertinent to epilepsy, highlighting shifts in energy distribution across distinct frequencies and modifications in the main frequency elements. Previous research has shown significant differences in EEG background waves across different age groups in the frequency domain, particularly in the early stages of child development, where \(\delta\) and \(\theta\) waves dominate brain wave activity and later on, \(\alpha\) and \(\beta\) waves gradually strengthen.  
(2) Edge: Using the correlation between the channels calculated using the wavelet coherence algorithm to establish edges between nodes. The connection can only be established if the correlation between channels is greater than a pre-set threshold. The structure of the graph is represented by the adjacency matrix representation of the edges as A.  
As mentioned earlier, analyzing EEG data solely from a time series perspective is often insufficient, as it may overlook important inter-channel spatial relationships inherent  
Figure 1: Overall workflow of SGAAE-AC.  
in EEG recordings. These spatial relationships can provide crucial insights into brain functional connectivity. Recent studies have confirmed this viewpoint by employing various correlation analysis methods, such as Multiscale Entropy (MSE), Phase Locking Value (PLV), and Euclidean Distance [26; 27].  
We choose wavelet coherence to measure the similarity or synchrony between two signals at specific times and frequencies. Compared to simple wavelet transforms, wavelet coherence considers the relationship between two signals by calculating the product of their wavelet transforms and integrating over a certain time window, thus assessing the coherence level of two signals at specific times and frequencies. The calculation method is as follows:  
\[W_{x}(t,f)=\int_{-\infty}^{+\infty}x(u)\cdot\theta_{t,f}^{*}(u)du \tag{1}\]  
\[CW_{xy}(t,f)=\int_{t-\frac{\theta}{2}}^{t+\frac{\theta}{2}}W_{x}(\tau,f)\cdot W _{y}^{*}(\tau,f) \tag{2}\]  
where \(W_{x}(t,f)\) represents the wavelet transform value of signal \(x(u)\) at time \(t\) and frequency \(f\). \(x(u)\) denotes the original signal, where \(u\) is the time variable, and \(\theta_{t,f}(u)\) is the wavelet function, dependent on time \(t\) and frequency \(f\).  
\(CW_{xy}(t,f)\) represents the wavelet coherence between two signals x and y at time \(t\) and frequency \(f\). \(W_{x}(\tau,f)\) and \(W_{y}(\tau,f)\), respectively, represent the wavelet transform values of signals \(x\) and \(y\) at time \(\tau\) and frequency \(f\). \(\theta\) is the width of the window.