Machine Learning-Based Gallstone Prediction Using Clinical Markers and Multiple Explainable AI Methods
Abstract
1. Introduction
- Three hyperparameter optimization techniques have been utilized and compared to enhance the classifiers. They are: (a) randomized search, (b) grid search and (c) Bayesian optimization.
- The ensemble model was customized by stacking nine different models. This has increased the precision, recall, and F1-score and has also made the prediction of gallstones more accurate.
- The eight XAI techniques, namely, SHAP, LIME, QLattice, Partial Dependence Plots (PDPs), Individual Conditional Expectations (ICEs), Eli5, anchor and counterfactual explanations make the predictions comprehensible, interpretable, and transparent. No one study exists that uses eight different XAI techniques for gallstone prediction. Explainers such as anchor and counterfactual explanations have rarely been used in ML research.
2. Materials and Methods
2.1. Dataset
2.2. Statistical Analysis and Data Preprocessing
2.3. Machine Learning and XAI Techniques
- SHapley Additive exPlanations (SHAP): It is a technique based on game theory that can be used to understand the outcomes of any classifier [16]. This approach applies game theory’s Shapley values to determine the optimal credit allocation based on local factors. The SHAP values distribute the outcome value across attributes for an estimation. The SHAP value assigned to each attribute represents its contribution to the definitive foresight.
- Local Interpretable Model-Agnostic Explanation (LIME): It produces interpretable features by discretizing each dimension [17]. It is an agnostic model and supports a wide range of ML algorithms.
- Partial Dependence Plots (PDPs): They show how the values of a feature or pair of features impact a model’s predictions [18]. They estimate the average effect of a predictor variable on the predictive variable.
- QLattice: ‘Abzu’ developed QLattice in 2018 [19]. It utilizes the concept of symbolic regression. Both numerical and categorical attributes can be entered as the input. The model explanation is created with QGraphs. They include activation functions, edges, and nodes. The activation function alters the output, connecting nodes and representing each attribute with a node.
- Individual Conditional Expectation (ICE): ICE plots depict the variation in the fitted values. They suggest where and to what extent heterogeneities exist [20]. They disaggregate the averaged data, allowing researchers to analyze the effect of the predictor variable at each value level while maintaining the values of the other predictor variables constant.
- Explain Like I am 5 (Eli5): Eli5 is a Python package that explains the predictions made by an algorithm [21]. It supports a diverse set of machine learning algorithms. It can successfully manage small consistency issues. Additionally, it facilitates code reuse. It is well known that Eli5 can manage both local and global interpretation.
- Anchor: The anchor method offers explanations that are specifically customized to the model’s behavior within the identical perturbation space, resulting in enhanced accuracy and transparency [22]. It provides simple rule-based explanations for complex models by identifying stable prediction conditions. It is useful for decision-making in scenarios where trust and clarity are crucial.
- Counterfactual Explanation: A counterfactual explanation indicates what should have changed in an event for observing a different outcome [23]. It depicts how certain changes to an input could lead to a different outcome.
- Grid Search: It involves defining a grid of hyperparameters. Each combination in the grid is carefully analyzed and evaluated [24]. This method involves the process of defining the hyperparameter grid, training and evaluating the model. Optimal hyperparameters are selected and the model is validated.
- Randomized Search: It works faster and more efficiently in high-dimensional spaces [25]. It samples the hyperparameters from specific distributions. This technique includes defining hyperparameter distributions, random sampling, training and evaluating models, selecting optimal hyperparameters, and validating the models.
- Bayesian Optimization: Hyperparameters are selected through Bayes’ theorem [26]. An acquisition function balances the exploration and exploitation stages of the search process after the search space is defined.
3. Results
3.1. Classification Results
3.2. XAI Analysis
4. Discussion
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
Appendix A. Mathematical Formulations of the Machine Learning Algorithms and Hyperparameter Tuning Methods
Appendix A.1. Logistic Regression
Appendix A.2. K-Nearest Neighbors (KNNs)
Appendix A.3. Support Vector Machine (SVM)
Appendix A.3.1. Linear SVM
Appendix A.3.2. Kernel SVM (RBF Kernel)
Appendix A.4. Decision Tree Classifier
Appendix A.5. Random Forest
Appendix A.6. AdaBoost
Appendix A.7. Gradient Boosting
Appendix A.8. XGBoost
Appendix A.9. CatBoost
Appendix A.10. Customized Stacking Ensemble (Meta-Learner)
Appendix A.11. Hyperparameter Tuning Methods
Appendix A.11.1. Grid Search
Appendix A.11.2. Randomized Search
Appendix A.11.3. Bayesian Optimization
References
- Sanders, G.; Kingsnorth, A.N. Gallstones. BMJ Clin. Rev. 2007, 335, 295–299. [Google Scholar] [CrossRef] [Scilit]
- Lammert, F.; Gurusamy, K.; Ko, C.W.; Miquel, J.-F.; Méndez-Sánchez, N.; Portincasa, P.; van Erpecum, K.J.; van Laarhoven, C.J.; Wang, D.Q.-H. Gallstones. Nat. Rev. Dis. Primers 2016, 2, 16024. [Google Scholar] [PubMed]
- Johnston, D.E.; Kaplan, M.M. Pathogenesis and Treatment of Gallstones. N. Engl. J. Med. 1993, 328, 412–421. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Gaby, A.R. Nutritional approaches to prevention and treatment of gallstones. Altern. Med. Rev. 2009, 14, 258. [Google Scholar] [PubMed]
- Friedman, M.G.D. Natural history of asymptomatic and symptomatic gallstones. Am. J. Surg. 1993, 165, 399–404. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Deng, L.; Wang, S.; Wan, D.; Zhang, Q.; Shen, W.; Liu, X.; Zhang, Y. Relative Fat Mass and Physical Indices as Predictors of Gallstone Formation: Insights from Machine Learning and Logistic Regression. Int. J. Gen. Med. 2025, 18, 509–527. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Ma, Y.; Yue, P.; Zhang, J.; Yuan, J.; Liu, Z.; Chen, Z. Early prediction of acute gallstone pancreatitis. Ann. Med. 2024, 56, 2357354. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Salem, N.M.; Jack, K.M.; Gu, H.; Kumar, A.; Garcia, M.; Yang, P.; Dinu, V. Machine and deep learning identified metabolites and clinical features. Comput. Methods Programs Biomed. Update 2023, 3, 100106. [Google Scholar] [CrossRef] [Scilit]
- Esen, İ.; Arslan, H.; Aktürk Esen, S.M.; Gülşen, M.; Kültekin, N.; Özdemir, O.M. Early prediction of gallstone disease with a machine learning-based method from bioimpedance and laboratory data. Medicine 2024, 103, 8. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Hong, C.; Zafar, I.; Ayaz, M.M.; Kanwal, R.; Kanwal, F.; Dauelbait, M.; Bourhia, M.; Jardan, Y.A.B. Analysis of Machine Learning Algorithms for Real-Time Gallbladder Stone Identification from Ultrasound Images in Clinical Decision Support Systems. Int. J. Comput. Intell. Syst. 2025, 18, 73. [Google Scholar] [CrossRef] [Scilit]
- Dalai, C.; Azizian, J.M.; Trieu, H.; Rajan, A.; Chen, F.; Dong, T.; Beaven, S.W.; Tabibian, J.H. Machine learning models compared to existing criteria for noninvasive prediction of endoscopic retrograde cholangiopancreatography-confirmed choledocholithiasis. Liver Res. 2021, 5, 224–231. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Zhang, X.; Yue, P.; Zhang, J.; Yang, M.; Chen, J.; Zhang, B.; Luo, W.; Wang, M.; Da, Z.; Li, X.; et al. A novel machine learning model and a public online prediction platform for prediction of post-ERCP-cholecystitis (PEC). eClinicalMedicine 2022, 48, 101431. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Shao, G.; Ma, Y.; Wang, L.; Qu, C.; Gao, R.; Sun, P.; Cao, J. Machine learning models based on dietary data to predict gallstones: NHANES 2017–2020. Res. Sq. 2024. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Ahsan, M.M.; Mahmud, M.A.P.; Saha, P.K.; Gupta, K.D.; Siddique, Z. Effect of Data Scaling Methods on Machine Learning Algorithms and Model Performance. Technologies 2021, 9, 52. [Google Scholar] [CrossRef] [Scilit]
- Koopialipoor, M.; Asteris, P.G.; Mohammed, A.S.; Alexakis, D.E.; Mamou, A.; Armaghani, D.J. Introducing stacking machine learning approaches for the prediction of rock deformation. Transp. Geotech. 2022, 34, 100756. [Google Scholar] [CrossRef] [Scilit]
- Feng, D.-C.; Wang, W.-J.; Mangalathu, S.; Taciroglu, E. Interpretable XGBoost-SHAP Machine-Learning Model for Shear Strength Prediction of Squat RC Walls. J. Struct. Eng. 2021, 147, 04021173. [Google Scholar] [CrossRef] [Scilit]
- Garreau, D.; von Luxburg, U. Explaining the Explainer: A First Theoretical Analysis of LIME. In Proceedings of the Twenty Third International Conference on Artificial Intelligence and Statistics, Palermo, Italy, 26–28 August 2020; Volume 108, pp. 1287–1296. [Google Scholar]
- Kerrigan, D.; Barr, B.; Bertini, E. PDPilot: Exploring Partial Dependence Plots Through Ranking, Filtering, and Clustering. IEEE Trans. Vis. Comput. Graph. 2025, 3, 7377–7390. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Sun, D.; Ding, Y.; Wen, H.; Zhang, F. A novel QLattice-based whitening machine learning model of landslide susceptibility mapping. Earth Surf. Processes Landf. 2023, 49, 304–317. [Google Scholar] [CrossRef] [Scilit]
- Goldstein, A.; Kapelner, A.; Bleich, J.; Pitkin, E. Peeking Inside the Black Box: Visualizing Statistical Learning with Plots of Individual Conditional Expectation. J. Comput. Graph. Stat. 2015, 24, 44–65. [Google Scholar] [CrossRef] [Scilit]
- Khanna, V.V.; Chadaga, K.; Sampathila, N.; Prabhu, S. A machine learning and explainable artificial intelligence triage-prediction system for COVID-19. Decis. Anal. J. 2023, 7, 100246. [Google Scholar] [CrossRef] [Scilit]
- Thanathamathee, P.; Sawangarreerak, S.; Nizam, D.N.M. Enhancing Going Concern Prediction with Anchor Explainable AI and Attention-Weighted XGBoost. IEEE Access 2024, 12, 68345–68363. [Google Scholar] [CrossRef] [Scilit]
- Guidotti, R. Counterfactual explanations and how to find them: Literature review and benchmarking. Data Min. Knowl. Discov. 2022, 38, 2770–2824. [Google Scholar] [CrossRef] [Scilit]
- Belete, D.M.; Huchaiah, M.D. Grid search in hyperparameter optimization of machine learning models for prediction of HIV/AIDS test results. Int. J. Comput. Appl. 2022, 44, 875–886. [Google Scholar] [CrossRef] [Scilit]
- Subaşı, N. Comprehensive Analysis of Grid and Randomized Search on Dataset Performance. Eur. J. Eng. Appl. Sci. 2024, 7, 77–83. [Google Scholar] [CrossRef] [Scilit]
- Stuke, A.; Rinke, P.; Todorović, M. Efficient hyperparameter tuning for kernel ridge regression with bayesian optimization. Mach. Learn. Sci. Technol. 2021, 2, 035022. [Google Scholar] [CrossRef] [Scilit]
- Kumar, D.; Mehta, M.A.; Kotecha, K.; Kulkarni, A. Computer-aided cholelithiasis diagnosis using explainable convolutional neural network. Sci. Rep. 2025, 15, 4249. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Bin, C.; Zhang, C. The association between vitamin D consumption and gallstones in US adults: A cross-sectional study from the national health and nutrition examination survey. J. Formos. Med. Assoc. 2025, 124, 212–217. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Jiang, Z.; Jiang, H.; Zhu, X.; Zhao, D.; Su, F. The relationship between high-sensitivity C-reactive protein and gallstones: A cross-sectional analysis. Front. Med. 2024, 11, 1453129. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Ataş, A.E.; Ünüvar, Ş. High visceral adiposity and low skeletal muscle mass independently predict the development of acute cholecystitis in patients with gallstones: A retrospective cohort study. Front. Med. 2025, 12, 1724416. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Ali, M.L.; Zhang, Z. The YOLO Framework: A Comprehensive Review of Evolution, Applications, and Benchmarks in Object Detection. Computers 2024, 13, 336. [Google Scholar] [CrossRef] [Scilit]















| Authors | Data Used | ML Models | Accuracy | XAI Techniques |
|---|---|---|---|---|
| Chen Hong et al. [10] | Local hospitals | Random Forest | 96.33% | Grad-CAM, saliency maps |
| C. Dalai et al. [11] | ERCP-confirmed patient data | XGBoost, RF, SVM | 83% | SHAP |
| Xu Zhang et al. [12] | ERCP patient records | Logistic regression, XGBoost | 85.5% | SHAP |
| Guanming Shao et al. [13] | NHANES (2017–2020) | XGBoost | 88% | SHAP |
| Marker | Description | Marker | Description |
|---|---|---|---|
| 1. Age | Age of the person | 20. Muscle mass (MM) | Muscle weight |
| 2. Gender | Gender of the person | 21. Obesity | Excessive adiposity |
| 3. Comorbidity | Concomitant diseases | 22. Total fat content (TFC) | Total fat amount |
| 4. Coronary Artery Disease (CAD) | Cardiovascular disease | 23. Visceral Fat Area (VFA) | Inner adipose tissue area |
| 5. Hypothyroidism | Underactive thyroid gland | 24. Visceral Muscle Area (VMA) | Inner muscle area |
| 6. Hyperlipidemia | High levels of fat in the blood | 25. Hepatic Fat Accumulation (HFA) | Accumulation of fat in the liver |
| 7. Diabetes Mellitus (DM) | High blood sugar | 26. Glucose | Blood sugar |
| 8. Height | Height is the length | 27. Total cholesterol (TC) | It is total cholesterol |
| 9. Weight | Body weight | 28. Low-Density Lipoprotein (LDL) | Bad cholesterol |
| 10. Body Mass Index (BMI) | Weight for height ratio | 29. High-Density Lipoprotein (HDL) | Good cholesterol |
| 11. Total Body Water (TBW) | Total water in the body | 30. Triglyceride | Type of fat found in the blood |
| 12. Extracellular water (ECW) | It is extracellular water | 31. Aspartate Aminotransferase (AST) | Type of liver enzyme |
| 13. Intracellular water (ICW) | It is intracellular water | 32. Alanine Aminotransferase (ALT) | An enzyme related to the liver |
| 14. Extracellular Fluid/Total Body Water (ECF/TBW) | Extracellular water content | 33. Alkaline Phosphatase (ALP) | Type of liver and bone enzyme |
| 15. Total Body Fat Ratio (TBFR) | Total fat content | 34. Creatinine | Kidney function indicator |
| 16. Lean Mass (LM) | Lean body mass | 35. Glomerular Filtration Rate (GFR) | Kidney filtration rate |
| 17. Body Protein Content (Protein) | Essential building blocks for the body | 36. C-Reactive Protein (CRP) | Inflammation indicator |
| 18. Visceral Fat Rating (VFR) | Visceral organ fat level | 37. Hemoglobin (HGB) | Protein in the blood that carries oxygen |
| 19. Bone Mass (BM) | Bone weight | 38. Vitamin D | Essential vitamin for bone health |
| Diagnosis | Mean | Median | Standard Deviation | Percentiles | |||
|---|---|---|---|---|---|---|---|
| 25th | 50th | 75th | |||||
| Age | Gallstone | 47.634 | 49.000 | 12.970 | 38.000 | 49.000 | 56.000 |
| No Gallstone | 48.513 | 50.000 | 11.200 | 39.250 | 50.000 | 56.000 | |
| Height | Gallstone | 168.230 | 170.000 | 9.772 | 162.000 | 170.000 | 175.000 |
| No Gallstone | 166.063 | 165.000 | 10.247 | 158.000 | 165.000 | 174.000 | |
| Weight | Gallstone | 79.809 | 78.000 | 15.976 | 69.200 | 78.000 | 90.500 |
| No Gallstone | 81.335 | 79.850 | 15.445 | 70.225 | 79.850 | 92.150 | |
| Body Mass Index (BMI) | Gallstone | 28.239 | 27.700 | 5.291 | 24.800 | 27.700 | 31.400 |
| No Gallstone | 29.528 | 29.150 | 5.275 | 26.025 | 29.150 | 32.475 | |
| Total Body Water (TBW) | Gallstone | 41.460 | 41.600 | 7.814 | 35.000 | 41.600 | 47.100 |
| No Gallstone | 39.699 | 38.250 | 7.974 | 33.625 | 38.250 | 46.600 | |
| Extracellular Water (ECW) | Gallstone | 17.629 | 17.500 | 2.943 | 15.700 | 17.500 | 19.700 |
| No Gallstone | 16.503 | 16.550 | 3.283 | 14.000 | 16.550 | 18.975 | |
| Intracellular Water (ICW) | Gallstone | 23.821 | 23.600 | 5.104 | 19.200 | 23.600 | 27.500 |
| No Gallstone | 23.444 | 22.550 | 5.598 | 19.525 | 22.550 | 27.950 | |
| Extracellular Fluid/Total Body Water (ECF/TBW) | Gallstone | 42.757 | 42.000 | 2.778 | 41.000 | 42.000 | 44.000 |
| No Gallstone | 41.657 | 42.000 | 3.584 | 39.820 | 42.000 | 44.000 | |
| Total Body Fat Ratio (TBFR) (%) | Gallstone | 26.392 | 25.800 | 8.408 | 20.100 | 25.800 | 31.700 |
| No Gallstone | 30.194 | 31.050 | 8.065 | 23.992 | 31.050 | 36.015 | |
| Lean Mass (LM) (%) | Gallstone | 73.522 | 73.930 | 8.384 | 68.320 | 73.930 | 79.750 |
| No Gallstone | 69.718 | 68.790 | 8.075 | 63.992 | 68.790 | 75.995 | |
| Body Protein Content (Protein) (%) | Gallstone | 16.138 | 16.130 | 2.102 | 14.670 | 16.130 | 17.420 |
| No Gallstone | 15.735 | 15.610 | 2.541 | 14.200 | 15.610 | 17.408 | |
| Bone Mass (BM) | Gallstone | 2.912 | 2.900 | 0.497 | 2.500 | 2.900 | 3.300 |
| No Gallstone | 2.692 | 2.600 | 0.500 | 2.300 | 2.600 | 3.000 | |
| Muscle Mass (MM) | Gallstone | 55.252 | 55.200 | 10.140 | 46.500 | 55.200 | 63.000 |
| No Gallstone | 53.276 | 52.250 | 10.999 | 44.750 | 52.250 | 61.925 | |
| Obesity (%) | Gallstone | 29.994 | 25.800 | 21.598 | 14.100 | 25.800 | 43.000 |
| No Gallstone | 29.574 | 24.670 | 20.870 | 13.900 | 24.670 | 37.355 | |
| Total Fat Content (TFC) | Gallstone | 21.871 | 20.100 | 9.649 | 15.100 | 20.100 | 26.700 |
| No Gallstone | 25.135 | 24.750 | 9.309 | 18.625 | 24.750 | 29.750 | |
| Visceral Fat Area (VFA) | Gallstone | 11.441 | 10.600 | 5.331 | 7.900 | 10.600 | 14.500 |
| No Gallstone | 12.916 | 12.485 | 5.101 | 9.100 | 12.485 | 15.795 | |
| Visceral Muscle Area (VMA) (Kg) | Gallstone | 30.725 | 30.800 | 4.784 | 26.800 | 30.800 | 34.200 |
| No Gallstone | 30.075 | 29.907 | 4.094 | 27.511 | 29.907 | 32.814 | |
| Glucose | Gallstone | 109.199 | 99.000 | 48.810 | 93.000 | 99.000 | 110.000 |
| No Gallstone | 108.169 | 97.000 | 40.566 | 91.000 | 97.000 | 107.750 | |
| Total Cholesterol (TC) | Gallstone | 202.857 | 199.000 | 43.285 | 172.000 | 199.000 | 234.000 |
| No Gallstone | 204.146 | 198.000 | 48.278 | 173.000 | 198.000 | 230.750 | |
| Low-Density Lipoprotein (LDL) | Gallstone | 128.805 | 125.000 | 36.043 | 105.000 | 125.000 | 152.000 |
| No Gallstone | 124.459 | 119.000 | 40.929 | 95.000 | 119.000 | 148.750 | |
| High-Density Lipoprotein (HDL) | Gallstone | 46.696 | 45.000 | 12.005 | 38.000 | 45.000 | 54.000 |
| No Gallstone | 52.308 | 47.500 | 21.749 | 43.000 | 47.500 | 58.000 | |
| Triglyceride | Gallstone | 149.425 | 119.000 | 104.830 | 82.000 | 119.000 | 188.000 |
| No Gallstone | 139.486 | 118.500 | 90.362 | 89.000 | 118.500 | 163.750 | |
| Aspartate Aminotransferase (AST) | Gallstone | 23.913 | 20.000 | 17.159 | 16.000 | 20.000 | 27.000 |
| No Gallstone | 19.415 | 16.500 | 15.950 | 14.000 | 16.500 | 21.000 | |
| Alanine Aminotransferase (ALT) | Gallstone | 28.012 | 21.000 | 23.878 | 14.000 | 21.000 | 33.000 |
| No Gallstone | 25.677 | 18.000 | 31.481 | 14.625 | 18.000 | 27.000 | |
| Alkaline Phosphatase (ALP) | Gallstone | 70.484 | 69.000 | 25.091 | 56.000 | 69.000 | 83.000 |
| No Gallstone | 75.791 | 73.000 | 22.988 | 60.000 | 73.000 | 88.750 | |
| Creatinine | Gallstone | 0.824 | 0.820 | 0.177 | 0.680 | 0.820 | 0.960 |
| No Gallstone | 0.777 | 0.745 | 0.173 | 0.640 | 0.745 | 0.898 | |
| Glomerular Filtration Rate (GFR) | Gallstone | 101.294 | 104.720 | 16.196 | 94.100 | 104.720 | 110.860 |
| No Gallstone | 100.335 | 102.900 | 17.766 | 95.023 | 102.900 | 110.550 | |
| C-Reactive Protein (CRP) | Gallstone | 0.462 | 0.000 | 2.482 | 0.000 | 0.000 | 0.310 |
| No Gallstone | 3.272 | 1.290 | 6.335 | 0.200 | 1.290 | 3.450 | |
| Hemoglobin (HGB) | Gallstone | 14.764 | 14.900 | 1.737 | 13.600 | 14.900 | 16.000 |
| No Gallstone | 14.066 | 14.200 | 1.751 | 12.900 | 14.200 | 15.375 | |
| Vitamin D | Gallstone | 24.905 | 25.270 | 9.116 | 19.625 | 25.270 | 30.200 |
| No Gallstone | 17.831 | 17.000 | 9.576 | 9.950 | 17.000 | 23.775 | |
| Statistic | df | p | ||
|---|---|---|---|---|
| Age | Student’s t | −0.647 | 317 | 0.518 |
| Height | Student’s t | 1.933 | 317 | 0.054 |
| Weight | Student’s t | −0.868 | 317 | 0.386 |
| Body Mass Index (BMI) | Student’s t | −2.180 | 317 | 0.030 |
| Total Body Water (TBW) | Student’s t | 1.993 | 317 | 0.047 |
| Extracellular Water (ECW) | Student’s t | 3.229 | 317 | 0.001 |
| Intracellular Water (ICW) | Student’s t | 0.628 | 317 | 0.530 |
| Extracellular Fluid/Total Body Water (ECF/TBW) | Student’s t | 3.068 | 317 | 0.002 |
| Total Body Fat Ratio (TBFR) (%) | Student’s t | −4.120 | 317 | <0.001 |
| Lean Mass (LM) (%) | Student’s t | 4.126 | 317 | <0.001 |
| Body Protein Content (%) | Student’s t | 1.545 | 317 | 0.123 |
| Bone Mass (BM) | Student’s t | 3.950 | 317 | <0.001 |
| Muscle Mass (MM) | Student’s t | 1.668 | 317 | 0.096 |
| Obesity (%) | Mann–Whitney U | 12,861.0 | 317 | 0.864 |
| Total Fat Content (TFC) | Student’s t | −3.074 | 317 | 0.002 |
| Visceral Fat Area (VFA) | Student’s t | −2.525 | 317 | 0.012 |
| Visceral Muscle Area (VMA) (Kg) | Student’s t | 1.303 | 317 | 0.194 |
| Hepatic Fat Accumulation (HFA) | Student’s t | −1.614 | 317 | 0.108 |
| Glucose | Student’s t | 0.205 | 317 | 0.838 |
| Total Cholesterol (TC) | Student’s t | −0.251 | 317 | 0.802 |
| Low-Density Lipoprotein (LDL) | Student’s t | 1.007 | 317 | 0.315 |
| High-Density Lipoprotein (HDL) | Student’s t | −2.860 | 317 | 0.005 |
| Triglyceride | Student’s t | 0.906 | 317 | 0.365 |
| Aspartate Aminotransferase (AST) | Student’s t | 2.424 | 317 | 0.016 |
| Alanine Aminotransferase (ALT) | Student’s t | 0.747 | 317 | 0.455 |
| Alkaline Phosphatase (ALP) | Student’s t | −1.968 | 317 | 0.050 |
| Creatinine | Student’s t | 2.376 | 317 | 0.018 |
| Glomerular Filtration Rate (GFR) | Student’s t | 0.504 | 317 | 0.615 |
| C-Reactive Protein (CRP) | Mann–Whitney U | 5312.5 | 317 | <0.001 |
| Hemoglobin (HGB) | Student’s t | 3.575 | 317 | <0.001 |
| Vitamin D | Student’s t | 6.758 | 317 | <0.001 |
| Attribute | p-Value |
|---|---|
| Gender | 0.006 |
| Comorbidity | 0.394 |
| Coronary Artery Disease (CAD) | 0.083 |
| Hypothyroidism | 0.324 |
| Hyperlipidemia | 0.004 |
| Diabetes Mellitus (DM) | 0.062 |
| Classifier | Accuracy (%) | Precision (%) | Recall (%) | F1-Score (%) | AUC | MCC | Log Loss | Jaccard Score | Hamming Loss |
|---|---|---|---|---|---|---|---|---|---|
| Grid Search | |||||||||
| Random Forest | 80 | 81 | 79 | 80 | 0.86 | 0.59 | 0.49 | 0.66 | 0.2 |
| Logistic Regression | 80 | 80 | 80 | 80 | 0.85 | 0.6 | 0.47 | 0.67 | 0.2 |
| KNN | 56 | 56 | 56 | 56 | 0.61 | 0.12 | 1.77 | 0.3 | 0.44 |
| SVM | 72 | 72 | 72 | 72 | 0.88 | 0.66 | 0.63 | 0.69 | 0.28 |
| Decision Tree | 77 | 77 | 76 | 76 | 0.76 | 0.53 | 8.45 | 0.59 | 0.23 |
| AdaBoost | 80 | 80 | 79 | 79 | 0.87 | 0.6 | 0.54 | 0.63 | 0.2 |
| CatBoost | 81 | 81 | 81 | 81 | 0.89 | 0.63 | 0.43 | 0.67 | 0.19 |
| XGBoost | 80 | 80 | 80 | 80 | 0.91 | 0.59 | 0.41 | 0.65 | 0.2 |
| Gradient Boosting | 81 | 81 | 81 | 81 | 0.87 | 0.66 | 0.71 | 0.69 | 0.19 |
| Soft Voting | 84 | 84 | 84 | 84 | 0.89 | 0.69 | 0.45 | 0.72 | 0.16 |
| Hard Voting | 86 | 86 | 86 | 86 | N/A | 0.72 | N/A | 0.74 | 0.14 |
| Stacking | 81 | 81 | 81 | 81 | 0.90 | 0.63 | 0.42 | 0.68 | 0.19 |
| Randomized Search | |||||||||
| Random Forest | 77 | 78 | 76 | 77 | 0.87 | 0.53 | 0.47 | 0.62 | 0.23 |
| Logistic Regression | 80 | 80 | 80 | 80 | 0.86 | 0.60 | 0.47 | 0.67 | 0.20 |
| KNN | 56 | 56 | 56 | 56 | 0.61 | 0.12 | 1.77 | 0.30 | 0.44 |
| SVM | 72 | 72 | 72 | 72 | 0.81 | 0.44 | 0.53 | 0.54 | 0.28 |
| Decision Tree | 77 | 77 | 76 | 77 | 0.76 | 0.53 | 8.45 | 0.59 | 0.23 |
| AdaBoost | 83 | 83 | 83 | 83 | 0.86 | 0.66 | 0.59 | 0.69 | 0.17 |
| CatBoost | 83 | 83 | 83 | 83 | 0.91 | 0.66 | 0.40 | 0.69 | 0.17 |
| XGBoost | 80 | 80 | 80 | 80 | 0.90 | 0.59 | 0.45 | 0.66 | 0.20 |
| Gradient Boosting | 81 | 81 | 81 | 81 | 0.88 | 0.62 | 0.42 | 0.68 | 0.19 |
| Soft Voting | 84 | 84 | 84 | 84 | 0.90 | 0.66 | 0.42 | 0.69 | 0.16 |
| Hard Voting | 83 | 83 | 83 | 83 | N/A | 0.69 | N/A | 0.73 | 0.17 |
| Stacking | 84 | 84 | 84 | 84 | 0.90 | 0.69 | 0.42 | 0.73 | 0.16 |
| Bayesian Optimization | |||||||||
| Random Forest | 78 | 83 | 73 | 77 | 0.86 | 0.57 | 0.48 | 0.65 | 0.22 |
| Logistic Regression | 80 | 80 | 80 | 80 | 0.86 | 0.6 | 0.47 | 0.67 | 0.2 |
| KNN | 56 | 56 | 56 | 56 | 0.61 | 0.12 | 1.77 | 0.3 | 0.44 |
| SVM | 72 | 72 | 72 | 72 | 0.81 | 0.44 | 0.53 | 0.54 | 0.28 |
| Decision Tree | 77 | 77 | 76 | 76 | 0.76 | 0.53 | 8.45 | 0.59 | 0.23 |
| AdaBoost | 83 | 83 | 83 | 83 | 0.86 | 0.66 | 0.59 | 0.69 | 0.17 |
| CatBoost | 83 | 83 | 83 | 83 | 0.90 | 0.66 | 0.4 | 0.69 | 0.17 |
| XGBoost | 80 | 80 | 80 | 80 | 0.90 | 0.59 | 0.45 | 0.66 | 0.2 |
| Gradient Boosting | 81 | 81 | 81 | 81 | 0.88 | 0.62 | 0.42 | 0.68 | 0.19 |
| Soft Voting | 84 | 84 | 84 | 84 | 0.89 | 0.69 | 0.45 | 0.72 | 0.16 |
| Hard Voting | 83 | 83 | 83 | 83 | N/A | 0.63 | N/A | 0.67 | 0.17 |
| Stacking | 80 | 80 | 80 | 80 | 0.90 | 0.59 | 0.43 | 0.65 | 0.20 |
| Algorithm | Grid Search | Randomized Search | Bayesian Optimization |
|---|---|---|---|
| - | {“n_estimators”: [50, 100, 150], “max_depth”: [None, 10, 20], “min_samples_split”: [2, 5, 10], “min_samples_leaf”: [1, 2, 4], “bootstrap”: [True, False],} | {“n_estimators”: np.arange(50, 200, 50), “max_depth”: [None, 10, 20, 30], “min_samples_split”: np.arange(2, 10, 2), “min_samples_leaf”: np.arange(1, 5, 1), “bootstrap”: [True, False],} | {“n_estimators”: Integer(50, 150), “max_depth”: Categorical([None, 10, 20]), # Categorical for discrete values “min_samples_split”: Integer(2, 10), “min_samples_leaf”: Integer(1, 4), space “bootstrap”: Categorical([True, False]),} |
| Random Forest | {‘bootstrap’: False, ‘max_depth’: 10, ‘min_samples_leaf’: 2, ‘min_samples_split’: 2, ‘n_estimators’: 100} | {‘n_estimators’: 200, ‘min_samples_split’: 2, ‘min_samples_leaf’: 4, ‘max_depth’: 5, ‘bootstrap’: True} | {‘bootstrap’: True, ‘max_depth’: 20, ‘min_samples_leaf’: 4, ‘min_samples_split’: 5, ‘n_estimators’: 117} |
| Logistic Regression | {‘C’: 0.1, ‘penalty’: ‘l1’, ‘solver’: ‘liblinear’} | {‘solver’: ‘liblinear’, ‘penalty’: ‘l1’, ‘C’: 0.1} | {‘C’: 0.29397976202716886, ‘penalty’: ‘l2’, ‘solver’: ‘liblinear’} |
| KNN | {‘metric’: ‘euclidean’, ‘n_neighbors’: 9, ‘weights’: ‘distance’} | {‘weights’: ‘distance’, ‘n_neighbors’: 3, ‘metric’: ‘minkowski’} | {‘metric’: ‘minkowski’, ‘n_neighbors’: 9, ‘weights’: ‘distance’} |
| SVM | {‘C’: 10, ‘gamma’: ‘scale’, ‘kernel’: ‘linear’} | {‘kernel’: ‘rbf’, ‘gamma’: ‘scale’, ‘C’: 1} | {‘C’: 3.9728931339630273, ‘gamma’: ‘scale’, ‘kernel’: ‘linear’} |
| Decision Tree | {‘criterion’: ‘gini’, ‘max_depth’: 2, ‘min_samples_leaf’: 1, ‘min_samples_split’: 2} | {‘min_samples_split’: 5, ‘min_samples_leaf’: 8, ‘max_depth’: 2, ‘criterion’: ‘entropy’} | {‘criterion’: ‘gini’, ‘max_depth’: 2, ‘min_samples_leaf’: 8, ‘min_samples_split’: 3} |
| AdaBoost | {‘learning_rate’: 0.1, ‘n_estimators’: 100} | {‘n_estimators’: 200, ‘learning_rate’: 0.2} | {‘learning_rate’: 0.2568157624707026, ‘n_estimators’: 50} |
| CatBoost | {‘depth’: 6, ‘iterations’: 200, ‘l2_leaf_reg’: 3, ‘learning_rate’: 0.05} | {‘learning_rate’: 0.01, ‘l2_leaf_reg’: 7, ‘iterations’: 1000, ‘depth’: 10} | {‘depth’: 8, ‘iterations’: 476, ‘l2_leaf_reg’: 2, ‘learning_rate’: 0.01543210934155101} |
| XGBoost | {‘learning_rate’: 0.1, ‘max_depth’: 6, ‘n_estimators’: 100, ‘subsample’: 0.5} | {‘subsample’: 1.0, ‘n_estimators’: 200, ‘max_depth’: 9, ‘learning_rate’: 0.3} | {‘learning_rate’: 0.07385485392202742, ‘max_depth’: 7, ‘n_estimators’: 251, ‘subsample’: 0.5000000001417663} |
| Gradient Boosting | {‘learning_rate’: 0.2, ‘max_depth’: 5, ‘n_estimators’: 100, ‘subsample’: 1.0} | {‘subsample’: 0.5, ‘n_estimators’: 300, ‘max_depth’: 2, ‘learning_rate’: 0.01} | {‘learning_rate’: 0.09015555039236096, ‘max_depth’: 5, ‘n_estimators’: 133, ‘subsample’: 0.594212645882715} |
| Stacking | Logistic regression; out-of-fold predicted probabilities (cv = 5, stack_method = ‘predict_proba’, passthrough = False); no calibration; 0.5 threshold | Logistic regression; out-of-fold predicted probabilities (cv = 5, stack_method = ‘predict_proba’, passthrough = False); no calibration; 0.5 threshold | Logistic regression; out-of-fold predicted probabilities (cv = 5, stack_method = ‘predict_proba’, passthrough = False); no calibration; 0.5 threshold |
| Prediction | Condition | Precision | Coverage |
|---|---|---|---|
| Presence of gallstone | C-Reactive Protein (CRP) > −0.33 AND Vitamin D <= −0.91 | 0.84 | 0.15 |
| Absence of gallstone | C-Reactive Protein (CRP) <= −0.33 | 0.60 | 0.50 |
| Presence of gallstone | C-Reactive Protein (CRP) > −0.37 AND Extracellular Water (ECW) <= −0.69 | 0.77 | 0.16 |
| Absence of gallstone | Vitamin D > 0.66 | 0.62 | 0.25 |
| Absence of gallstone | C-Reactive Protein (CRP) <= −0.33 | 0.60 | 0.50 |
| Presence of gallstone | Vitamin D <= −0.91 AND Creatinine <= −0.85 | 0.74 | 0.10 |
| XAI Technique | Crucial Parameters |
|---|---|
| SHAP | C-Reactive Protein (CRP) Vitamin D Obesity Aspartate Aminotransferase (AST) Muscle Mass (MM) |
| LIME | Vitamin D Obesity Muscle Mass (MM) |
| Eli5 | C-Reactive Protein (CRP) Muscle Mass (MM) Creatinine Bone Mass (BM) Hemoglobin Vitamin D |
| QLattice | C-Reactive Protein (CRP) Vitamin D |
| PDP | Vitamin D C-Reactive Protein (CRP) |
| ICE | Vitamin D C-Reactive Protein (CRP) |
| Anchor | C-Reactive Protein (CRP) Vitamin D |
| Counterfactual Explanations | Vitamin D |
| Technique | Model Explained | Scope | Data Subset | Positive Class | Package | Key Settings |
|---|---|---|---|---|---|---|
| SHAP | Stacking ensemble | Global/Local | Test set | 1 (gallstone) | shap | KernelExplainer, background = k-means(train, 15), nsamples = 100 |
| LIME | Stacking ensemble | Local | Test set | 1 | lime | Default tabular explainer settings |
| ELI5 | Stacking ensemble | Global | Test set | 1 | eli5 | Permutation importance |
| QLattice | Independent model (not an explainer of the stacking ensemble) | — | Full set | 1 | feyn | “Addition” activation function |
| PDP | Stacking ensemble | Global | Test set | 1 | sklearn | features = [‘Vitamin D’, ‘C-Reactive Protein (CRP)’] |
| ICE | Stacking ensemble | Local | Test set | 1 | sklearn | kind = ‘individual’, features = [‘Vitamin D’, ‘C-Reactive Protein (CRP)’] |
| Anchor (rule-based) | Stacking ensemble | Local | Test set | 1 | alibi | threshold = 0.90, disc_perc = (25, 50, 75), batch_size = 100 |
| Counterfactual | Stacking ensemble | Local | Test set | 1 | Custom greedy implementation | max_rounds = 10, distance-penalized greedy search |
| Paper | Best Classifiers | Maximum Results | Dataset | XAI Techniques |
|---|---|---|---|---|
| [6] | Random Forest, logistic regression | Accuracy: 86% | Hospital-based clinical data | SHAP, LIME |
| [8] | Random Forest | Accuracy: 90% | Metabolomics & clinical datasets | SHAP |
| [9] | Random Forest | AUC: 0.85 | Bioimpedance and lab data | SHAP, LIME |
| [11] | XGBoost, Random Forest, SVM | Accuracy: 83% | ERCP-confirmed patient data | SHAP |
| [13] | XGBoost | Accuracy: 88% | NHANES 2017–2020 | SHAP |
| Our paper | AdaBoost, CatBoost, Customized ensemble model | AUC: 0.90 Accuracy: 83% | Gallstone Dataset, UC Irvine Machine Learning Repository | SHAP, LIME, Eli5, QLattice, PDP, ICE, Anchor, Counterfactual Explanations |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Sampathila, A.N.; Chadaga, K.; Bhat, D.; Sampathila, N. Machine Learning-Based Gallstone Prediction Using Clinical Markers and Multiple Explainable AI Methods. Computers 2026, 15, 668. https://doi.org/10.3390/computers15100668
Sampathila AN, Chadaga K, Bhat D, Sampathila N. Machine Learning-Based Gallstone Prediction Using Clinical Markers and Multiple Explainable AI Methods. Computers. 2026; 15(10):668. https://doi.org/10.3390/computers15100668
Chicago/Turabian StyleSampathila, Abhijay N., Krishnaraj Chadaga, Devadas Bhat, and Niranjana Sampathila. 2026. "Machine Learning-Based Gallstone Prediction Using Clinical Markers and Multiple Explainable AI Methods" Computers 15, no. 10: 668. https://doi.org/10.3390/computers15100668
APA StyleSampathila, A. N., Chadaga, K., Bhat, D., & Sampathila, N. (2026). Machine Learning-Based Gallstone Prediction Using Clinical Markers and Multiple Explainable AI Methods. Computers, 15(10), 668. https://doi.org/10.3390/computers15100668

