## 2 Materials and Methods
### Kernel Cross-Spectral Functional Connectivity Network (KCS-FCnet)  
Let \(x\in\mathcal{X}\) represent a wide-sense stationary stochastic process with a real-valued auto-correlation function \(R_{x}(\tau)\in\mathbb{R}\), defined as follows [41]:  
\[R_{x}(\tau)=\int_{\mathbb{R}}\exp(j2\pi\tau f)dP_{x}(f), \tag{1}\]  
where \(P_{x}(f)\in[0,1]\) is a monotonic, absolutely continuous, and differentiable spectral distribution function over the frequency domain \(f\in\mathbb{R}\). Considering two vectors \(\mathbf{x},\mathbf{x}^{\prime}\in\mathbb{R}^{T}\), Equation (1) can be extended from a univariate correlation function to a pairwise correlation using a generalized stationary kernel \(\kappa:\mathbb{R}^{T}\ \times\ \mathbb{R}^{T}\ \rightarrow\ \mathbb{R}\). This kernel maps the data into a Reproducing Kernel Hilbert Space (RKHS) via a nonlinear function \(\phi:\mathbb{R}^{T}\rightarrow\mathcal{H}\). [PERSON]'s theorem states that such an extension is valid under the assumption that the spectral representation between the vectors satisfies the following [42]:  
\[\kappa(\mathbf{x}-\mathbf{x}^{\prime})=\int_{\Omega}\exp\Big{(}j2\pi(\mathbf{x}-\mathbf{x}^{ \prime})^{\top}\mathbf{f}\Big{)}S_{\mathbf{x}\mathbf{x}^{\prime}}(f)df, \tag{2}\]  
where \(\mathbf{f}\in\Omega\) is a vector-valued frequency domain within the bandwidth \(\Omega\), and \(S_{\mathbf{x}\mathbf{x}^{\prime}}(\mathbf{f})\in\mathbb{C}\) is the cross-spectral density function, with \(S_{\mathbf{x}\mathbf{x}^{\prime}}(\mathbf{f})=dP_{\mathbf{x}\mathbf{x}^{\prime}}(\mathbf{f})/d\mathbf{f}\), where \(P_{\mathbf{x}\mathbf{x}^{\prime}}(\mathbf{f})\in[0,1]\) is the cross-spectral distribution. Thereby, the cross-spectral distribution yields the following:  
\[P_{\mathbf{x}\mathbf{x}^{\prime}}(\Omega)=2\int_{\Omega}\mathcal{F}\{\kappa(\mathbf{x}-\bm {x}^{\prime})\}df. \tag{3}\]  
where \(\mathcal{F}\{\cdot\}\) stands for the Fourier transform and \(P_{\mathbf{x}\mathbf{x}^{\prime}}(\Omega)\in[0,1]\) captures cross-frequency information by extracting nonlinear dependencies within \(\mathbf{f}\in\Omega\). Next, the Gaussian kernel is fixed in Equation (3) for its universal approximation capabilities and efficient computation:  
\[\kappa_{G}(\mathbf{x}-\mathbf{x}^{\prime};\sigma)=\exp\left(\frac{-\|\mathbf{x}-\mathbf{x}^{ \prime}\|_{2}^{2}}{2\sigma^{2}}\right), \tag{4}\]  
where \(\|\cdot\|_{2}\) is the \(l2\)-norm and \(\sigma\in\mathbb{R}^{+}\) is a scale hyperparameter. Now, let \(\{\mathbf{X}_{n}\in\mathbb{R}^{C\times T},\mathbf{y}_{n}\in\{0,1\}^{\bar{K}}\}_{n=1}^{N}\) be a subject-dependent input-output EEG-based pain detection dataset, holding \(N\) trials, \(T\) time instants, \(C\) channels, and \(\bar{K}\) classes. In particular, \(\bar{K}=2\) for no-pain vs. high-pain states. To capture the most informative EEG patterns from a given trial \(\mathbf{X}\), the Kernel Cross-Spectral Functional Connectivity Network (KCS-FCnet) estimates the cross-spectral distribution between EEG channels as in Equation (3) within a DL approach [35]. Indeed, KCS-FCnet uses 1-D convolutions to combine feature layers that pull out time-frequency patterns in each channel and a Gaussian kernel-based pairwise similarity as follows:  
\[\hat{\mathbf{P}}_{f}=\kappa_{G}(\cdot;\sigma)\circ\varphi(\cdot;\mathbf{w}_{f})(\mathbf{X}), \tag{5}\]  
where notation \(\circ\) stands for function composition, \(\varphi(\cdot;\mathbf{w}_{f})\) holds \(\bar{F}\) 1-D convolutional filters with \(\mathbf{w}_{f}\in\mathbb{R}^{\Delta_{T}}\), \(\Delta_{T}<T\), and \(f\in\{1,2,\ldots,\bar{F}\}\). Also, Equation (5) operates \(\kappa_{G}(\cdot;\sigma)\) for each pair of filtered EEG channels regarding the weights \(\mathbf{w}_{f}\); then, \(\hat{\mathbf{P}}_{f}\ \in\ [0,1]^{\mathbb{C}\times\mathbb{C}}\) holds the pairwise EEG channel kernel-based cross-spectral distribution feature map of the input trial \(\mathbf{X}\) for the \(f\)-th KCS-FCnet's filter.