Development and implementation of explainable AI-based machine learning models for predicting hospital stay and
Alireza Banaye Yazdipour1,2, Parisa Mehdizadeh3, Masoud Arabfard4
1Department of Health Information Technology, School of Paramedical and Rehabilitation Sciences, Mashhad University of Medical Sciences, Mashhad, Iran.
Insights
Machine learning models accurately predict hospital length of stay and treatment costs for cardiovascular disease patients undergoing angioplasty or CABG. The developed tool aids clinical decisions and resource planning.
Area of Science:
- Cardiovascular Medicine
- Health Informatics
- Machine Learning
Background:
- Cardiovascular disease (CVD) is a leading cause of mortality and significant healthcare expenditure.
- Predictive tools are crucial for managing hospital length of stay (LOS) and treatment costs in CVD patients undergoing procedures like angioplasty and coronary artery bypass grafting (CABG).
Purpose of the Study:
- To develop and validate machine learning (ML) models for predicting hospital LOS and treatment costs in cardiovascular inpatients.
- To create an explainable and clinically implementable decision support application.
Main Methods:
- A retrospective study analyzed 7685 adult inpatients undergoing angioplasty or CABG.
- Eight regression-based ML algorithms were trained to predict LOS, patient out-of-pocket costs, insurer payments, and total treatment costs.
- Model performance was assessed using R², RMSE, and MAE; SHAP analysis provided interpretability.
Main Results:
- The XGBoost model demonstrated superior performance across all prediction tasks.
- On the test set, XGBoost achieved R² values of 0.7802 for LOS, 0.8473 for patient OOP, 0.8946 for insurer payment, and 0.6437 for total cost.
- SHAP analysis identified LOS, intervention type, age, and comorbidities as key predictors.
Conclusions:
- A comprehensive, explainable ML framework was developed for predicting LOS and treatment costs in cardiovascular care.
- The deployed dual-platform application offers real-time, personalized predictions to support clinical and administrative decision-making.
- Future research should focus on external validation and incorporating broader variables for enhanced generalizability.
Abstract:
Cardiovascular disease (CVD) remains the leading cause of global morbidity and mortality, with substantial economic implications for healthcare systems. Among hospitalized CVD patients, procedures such as angioplasty and coronary artery bypass grafting (CABG) are associated with prolonged lengths of stay (LOS) and elevated treatment costs, underscoring the need for robust predictive tools to support clinical and administrative decision-making. Therefore, this study aimed to develop and validate machine learning (ML) models to predict hospital LOS and treatment costs for cardiovascular inpatients using real-world clinical data. This applied, retrospective predictive modeling study was conducted in 2024 at specialized cardiovascular clinic of a tertiary teaching hospital in Tehran, Iran. A cohort of 7685 adult inpatients who underwent angioplasty or CABG between 2022 and 2023 was analyzed. Eight regression-based ML algorithms were developed to predict four outcomes: hospital LOS, patient out-of-pocket (OOP), insurer payment, and total treatment cost. Model performance was evaluated using the coefficient of determination (R2), root mean squared error (RMSE), and mean absolute error (MAE). SHAP was applied to the best-performing model to enable both global and local interpretability. Finally, a dual-platform clinical decision support application (web-based and desktop) was developed. XGBoost consistently outperformed other models across all prediction tasks. On the test set, it achieved R2 values of 0.7802 for LOS, 0.8473 for patient OOP, 0.8946 for insurer payment, and 0.6437 for total cost. SHAP analysis revealed LOS, intervention type, age, and comorbidities as key predictors. The deployed application demonstrated real-time utility in generating personalized predictions based on patient characteristics. This study presents a comprehensive, explainable, and clinically implementable ML framework for predicting LOS and treatment costs in cardiovascular care. By integrating high-performing models with explainable AI and real-world application, this approach offers a scalable solution for enhancing hospital resource planning and optimizing patient outcomes. Future work should focus on external validation of the models across multiple hospitals and healthcare systems to enhance their generalizability. Additionally, integrating broader clinical and socioeconomic variables may further improve the predictive performance and expand the applicability of the developed decision support tool.

