Abstract
Epstein-Barr virus (EBV) exacerbates inflammatory bowel disease (IBD) and is challenging to monitor with invasive or costly tests. We investigated whether explainable machine learning can predict EBV infection from routine clinical data in ulcerative colitis (UC) and Crohn's disease (CD). In this retrospective study (June 2018-December 2022), EBV status was defined by EBV-DNA > 400 copies/mL. After cleaning, the training cohort (2018-2019) included 174 patients (CD = 122, UC = 52) and the test cohort (2020-2022) included 100 patients. Twenty-one demographic, clinical, and laboratory variables were modeled with ten classifiers; the four best were stacked. Five-fold cross-validation and resampling addressed overfitting and class imbalance. Shapley Additive Explanations (SHAP) provided model interpretability. The ensemble model exhibited high predictive accuracy, achieving area under the ROC curve (AUC) values of 0.93 (overall), 0.97 (CD), and 0.88 (UC) in the training set. In the validation set, AUC values were 0.95 (overall), 0.89 (CD), and 0.97 (UC). SHAP analysis identified age, hemoglobin (HB), total bile acids (TBA), and platelet count (PLT) as significant predictors. Age increased predicted risk in the overall and CD cohorts but decreased risk in UC. TBA emerged as a critical predictor in UC, reflecting its role in bile acid metabolism, while PLT influenced risk across the total patient population, indicating its involvement in coagulation and immune responses. An explainable stacking model using routine biomarkers accurately predicts EBV infection in IBD and reveals subtype-specific determinants. Prospective, multi-center and time-aware validation, and integration into decision-support tools are warranted for clinical deployment.