Abstract:Aim To construct and deploy an internally validated model for predicting the risk of carotid atherosclerosis (CAS) in physical examination populations on the shinyapps.io web platform, based on screening for the optimal machine learning algorithm model. Methods Retrospectively collected data from 4 096 subjects who underwent physical examinations at the Physical Examination Center of the First Hospital of Hebei Medical University from January to December 2024. Using simple random sampling, the sample was divided into a training set (3 072 cases) and a validation set (1 024 cases) in a 3∶1 ratio. The distribution of the outcome variable was balanced between the two groups (45.02% in the training set, 44.73% in the validation set, P=0.561). General information, physical examination indicators, lifestyle indicators, blood routine indicators, liver and kidney function indicators, and medical history of the subjects were collected. LASSO regression analysis (with optimal lambda value selected via 10-fold cross-validation) was used to screen for the best predictive factors, which were then incorporated into various machine learning algorithms (Logit, GNB, DT, RF, XGBoost, SVM, KNN, Bagging). Grid search and cross-validation were employed to optimize the hyperparameters of each model. Multiple model ROC curves were plotted to select the algorithm with the best performance.The SHAP package was used to evaluate the contribution of each predictive factor to the model's prediction results. Calibration curves of different machine learning algorithms were plotted for performance comparison, and the accuracy of each model was calculated. DCA curves were plotted to further validate the performance of the optimal machine learning algorithm. Finally, the selected optimal machine learning algorithm, XGBoost, was deployed on shinyapps.io.ResultsIn the training set, LASSO regression analysis identified gender, age, history of diabetes, history of hypertension, history of coronary heart disease, aspartate aminotransferase, body mass index, waist circumference, large platelet ratio, smoking, systolic blood pressure, white blood cell count, neutrophil count, atherosclerosis index, and high density lipoprotein cholesterol as factors influencing carotid artery stenosis (CAS). No multicollinearity was observed among variables (all VIF values<10). In the training set, XGBoost demonstrated the best performance, with AUC (95%CI), accuracy, sensitivity, specificity, F1-score, negative likelihood ratio (NLR), and positive likelihood ratio (PLR) for predicting CAS risk being 0.870 (0.857~0.883, P<0.001), 78.3%, 80.2%, 76.7%, 0.9,0.258, and 3.446, respectively. In the validation set, XGBoost also performed best, with AUC (95%CI), accuracy, sensitivity, specificity, F1-score, NLR, and PLR of 0.909 (0.890~0.928, P<0.001), 82.5%, 82.3%, 82.7%, 0.8,0.214, and 4.754, respectively. Additionally, XGBoost had the smallest standard deviation in AUC. SHAP analysis revealed that age contributed the most to the model's prediction of CAS risk, followed by systolic blood pressure. Calibration curves showed that the XGBoost model had a Brier score of 0.1831, which was comparable to the SVM model with the best calibration performance (0.1822), and its curve closely aligned with the ideal reference line across the entire probability range. Considering its optimal discriminative ability and clinical net benefit, this model exhibited the best overall performance. Clinical decision curves indicated that the XGBoost model provided clinical net benefit across a wide range of risk thresholds. In the training set, a web-based calculator for predicting CAS risk was developed based on the XGBoost model and deployed on shinyapps.io. The optimal cutoff probability for the model's predicted risk (determined by maximizing Youden's index) was 44.11%. Two subjects from the latest physical examination population were selected, and their relevant information was input into the web-based calculator. The results showed CAS risk probabilities of 66.33% and 11.41% for the two subjects, both falling within the risk threshold probability range, preliminarily demonstrating the clinical application potential of this calculator. Conclusions This study incorporated relatively comprehensive indicators for CAS risk and successfully developed an accurate, high-performance, practical web-based CAS risk prediction calculator based on the XGBoost model. It should be noted that this study was a cross-sectional design; the constructed model was only for assessing CAS prevalence risk and lacks the ability for future prediction over time. Future multi-center, prospective studies are needed to validate the model's generalizability and predictive performance.