## 1 Introduction
Despite these advancements, applying these DL approaches in the medical field, particularly for EEG-based pain detection, remains a significant challenge. First, their black box nature hinders interpretability, making it difficult to derive meaningful insights into the neurological mechanisms specific to each individual [32]. Second, these models frequently fail to account for the intricate interconnections between neurological, physiological, and behavioral factors [33]. Recognizing and incorporating these influences is essential to achieve more personalized outcomes. To face the above challenges, some approaches have been proposed to enhance the well-established EEGNet architecture. For instance, the Kernel Regularized EEGNet (KREEGNet) employs a Central Kernel Alignment (CKA) framework as a regularization strategy to optimize model performance [34]. In addition, the Kernel Cross-Spectral Functional Connectivity Network (KCS-FCnet) applies Gaussian kernels, aiming to determine functional connectivities and feeding these into a fully connected layer, which in turn maps EEG data into a higher-dimensional feature space to enhance its representation and favors classification tasks [35]. Nevertheless, subject-dependent approaches remain widely used, often lacking the necessary generalization for effective cross-subject pain assessment. On the other hand, in terms of interpretability, various attribution methods have emerged. Class Activation Maps (CAMs) are widely used for image-based tasks, as they identify which parts of the input most influence the model's decisions. Initially introduced in [36], CAMs employ weighted activations in a given layer to compute the impact of each feature on the outcome. Grad-CAM extends this by reweighting based on gradients from the model, though it presumes uniform importance across activations [37]. Yet, crucial spatio-frequency features remain unclear, limiting their potential for enhancing explainability in EEG-based pain detection [8]. We present an EEG-based pain detection framework for non-verbal patients leveraging the KCS-FCnet model [35]. We structure our approach into three key components:  
* KCS-FCnet-based Pain Detection: We employ 1D convolutional layers to extract rich spatio-frequency features from EEG channels. Additionally, cross-spectral distribution estimation is utilized to capture pain-related patterns, generating functional connectivity feature maps that reveal meaningful pairwise channel relationships. * Explainability through Frequency CAM (FCAM): To enhance model interpretability, we introduce Frequency CAM (FCAM), a novel technique that provides deeper insights into the model's decision-making by analyzing both input EEG channel importance and frequency band contributions to pain detection. * Cross-Subject Analysis: We address subject variability by performing cross-subject analysis and grouping, clustering individuals based on similar pain detection performance, functional connectivity patterns, sex, and age, thus improving generalizability across diverse populations. For testing, we employ the Brain Mediators of Pain dataset [38] to classify between no pain and high pain states. To assess the inter-subject generalization capabilities, we compare the performance of classical machine learning models, EEGNet, and our enhanced KCS-FCnet framework in EEG-based pain detection tasks [38]. Furthermore, we utilize both subject-dependent training and a leave-one-subject-out cross-validation strategy to evaluate model generalizability across different individuals. Our findings demonstrate that the proposed KCS-FCnet model offers a robust, non-invasive pain detection solution with enhanced spatio-frequency interpretability, making it particularly valuable for assisting in pain assessment for non-verbal patients. The remainder is as follows: Section 2 describes the materials and methods. Sections 3 and 4 present the experiments and discuss the results. Finally, Section 5 presents the conclusions and future work.