# GraphEPN: A Deep Learning Framework for B-Cell Epitope Prediction Leveraging Graph Neural Networks
## 2 Materials and Methods
### Model Training and Evaluation  
This study adopts a two-stage training strategy. First, the VQ-VAE model is trained in an unsupervised manner on the SAbDab_1323 dataset to learn the discrete and continuous representations of protein residues. The trained VQ-VAE model is subsequently utilized for encoding features from the SAbDab_665 dataset, and the concatenated features are employed for supervised epitope prediction via the graph transformer model.  
During the VQ-VAE pretraining phase, the model optimizes the learned representations by minimizing both the reconstruction loss and quantization loss. A masking mechanism is incorporated, where certain node features are randomly masked, compelling the model to recover these features via neighborhood information. The total loss function is controlled by three key parameters: \(\alpha\), \(\beta\), and \(\lambda\), which determine the relative contributions of reconstruction loss, vector quantization loss, and masked loss, respectively. Their values are empirically determined through grid search and set as follows: \(\alpha=1.0\), \(\beta=0.25\), and \(\lambda=1.5\), ensuring a balance between feature preservation and generalization. The Adam optimizer is employed for training, with weight decay applied to prevent overfitting [21]. The optimizer parameters are set as follows: learning rate = 0.01, weight decay = 0.0001, betas = (0.9, 0.999). The learning rate follows a cosine annealing schedule to improve convergence stability. The batch size is set to 64, balancing computational efficiency and generalization performance.  
In the training phase of the graph transformer, joint optimization of multiple loss functions, including binary cross-entropy loss and Dice loss, is performed to mitigate the class imbalance inherent in the dataset [22, 23]. The Adam optimizer, with the same parameter settings as in the VQ-VAE training phase, is employed, and a learning rate scheduler dynamically adjusts the learning rate to ensure stable convergence throughout the training process. A ReduceLROnPlateau scheduler is used to adjust the learning rate based on validation loss trends. Given the underrepresentation of epitope residues in the data, the loss function weights are adjusted to enhance the model's ability to recognize the minority class. The hidden units are set to 128, the batch size is set to 32, and the dropout rate is 0.4 to mitigate overfitting while maintaining expressiveness. To assess the generalization capability of the model, 5-fold cross-validation is employed [24]. In each fold, the dataset is split into a training set, a validation set, and a test set. The model is trained on the training set, and the validation set is used for tuning hyperparameters such as the learning rate, batch size, attention heads, hidden units, and dropout rate. The performance is then evaluated on the test set.  
After model training, an evaluation is conducted on the independent blind test dataset, Blind_42. Owing to the class imbalance in the data, multiple evaluation metrics are employed to assess the model's performance, including the F1-score, Matthews correlation coefficient (MCC), balanced accuracy (BACC), area under the curve (AUC), and area under the precision-recall curve (AUPRC) [25]. The F1-score measures the harmonic mean of precision and recall, making it particularly suitable for imbalanced datasets. MCC provides a robust evaluation metric that considers all four elements of the confusion matrix, ensuring a more reliable assessment even when the class distribution is skewed. BACC is designed to compensate for class imbalance by computing the mean recall of both classes. AUC quantifies the model's ability to distinguish between positive and negative samples across different decision thresholds, while AUPRC focuses on precision and recall trade-offs, which are particularly crucial for epitope prediction given the typically low prevalence of positive samples. As threshold-independent metrics, AUC and AUPRC serve as the primary evaluation criteria.