Cardiovasculardiseases (CVDs) remain one of the leading causes of mortality worldwide, emphasizing the need for intelligent systems capable of predicting disease progression and recommending personalized interventions. Conventional cardiovascular risk assessment models, including Framingham Risk Score and ASCVD calculators, provide static predictions and fail to capture the dynamic evolution of patient health over time. This research presents a Personalized AI Cardiovascular Risk Twin that integrates machine learning, deep learning, reinforcement learning, and explainable artificial intelligence into a unified clinical decision-support framework. A soft-voting ensemble classifier combining Logistic Regression and XGBoost is employed for accurate cardiovascular risk prediction. A GRU-Attention-based Digital Twin models temporal physiological changes and forecasts future cardiovascular trajectories. Based on this digital twin environment, a Proximal Policy Optimization (PPO) reinforcement learning agent learns personalized lifestyle and therapeutic interventions while maximizing long-term health outcomes. To ensure patient safety, a Rule-Guided Clinical Action-Masking Engine eliminates clinically inappropriate recommendations before policy execution. Model interpretability is enhanced using Kernel SHAP, enabling clinicians to understand feature contributions for every prediction. The complete framework is deployed through FastAPI, Streamlit, and SQLite to provide real-time prediction, simulation, explanation, and audit capabilities. Experimental evaluation demonstrates that the proposed framework improves predictive performance, supports personalized treatment planning, enhances transparency, and promotes clinically reliable AI-assisted cardiovascular care.
Introduction
This study proposes CardioTwin, a Personalized AI Cardiovascular Risk Twin Using Explainable Reinforcement Learning, to improve cardiovascular disease (CVD) prediction, continuous patient monitoring, and personalized treatment planning. Cardiovascular disease remains one of the leading causes of death worldwide, and traditional risk assessment tools such as the Framingham Risk Score, SCORE, and ASCVD Risk Calculator provide only static risk estimates based on a single clinical observation. These methods cannot capture the dynamic changes in a patient's health over time, limiting their effectiveness for personalized healthcare.
To address these limitations, the proposed framework integrates machine learning, Digital Twin technology, Reinforcement Learning (RL), and Explainable AI (XAI) into a unified clinical decision-support system. The system combines:
A soft-voting ensemble of Logistic Regression and XGBoost for cardiovascular risk prediction.
A GRU-Attention Digital Twin to simulate future patient health trajectories.
A Proximal Policy Optimization (PPO) reinforcement learning agent for personalized treatment recommendations.
A Rule-Guided Clinical Action-Masking Engine to ensure safe recommendations.
Kernel SHAP for transparent and interpretable predictions.
FastAPI, Streamlit, and SQLite for real-time deployment, visualization, and audit management.
Motivation
The research is motivated by the need for intelligent healthcare systems that provide continuous monitoring, personalized treatment, and transparent AI decisions. Existing AI models often function as "black boxes" and may recommend clinically inappropriate interventions due to the lack of safety constraints. By integrating explainability and rule-based safety mechanisms, the proposed framework aims to improve clinician trust and support precision cardiovascular care.
Objectives
The main objectives are to:
Develop an AI-based cardiovascular risk prediction model.
Build a Digital Twin that models patient health over time.
Use reinforcement learning to recommend personalized lifestyle and medical interventions.
Ensure clinical safety using rule-guided action masking.
Provide explainable predictions using SHAP.
Deploy the complete system as an interactive clinical decision-support platform.
Literature Review
Traditional cardiovascular risk prediction models rely on statistical methods and produce static predictions. More recent studies have demonstrated that ensemble machine learning improves prediction accuracy, while Digital Twin technology enables dynamic patient simulation. Reinforcement learning has been explored for treatment optimization, but previous approaches often focused on limited interventions and lacked safety considerations. Although SHAP and LIME have improved AI interpretability, they have rarely been integrated with reinforcement learning for personalized treatment planning.
Methodology
The proposed CardioTwin framework consists of several integrated modules:
1. Data Preprocessing
Patient records undergo:
Outlier removal using Interquartile Range (IQR).
Multicollinearity analysis using Variance Inflation Factor (VIF).
Feature normalization using StandardScaler.
Binary encoding of categorical variables.
Stratified 80:20 train-test split.
2. Cardiovascular Risk Prediction
Risk prediction is performed using a Soft Voting Ensemble combining:
Logistic Regression
Extreme Gradient Boosting (XGBoost)
The dataset imbalance is addressed using SMOTE, and the classification threshold is optimized using Youden's J statistic to maximize sensitivity while maintaining acceptable precision.
3. Digital Twin Simulation
A GRU-Attention neural network models patient health over time by learning temporal physiological changes. The Digital Twin predicts future health states using recurrent neural networks combined with multi-head self-attention. Monte Carlo Dropout estimates prediction uncertainty, improving reliability.
4. Reinforcement Learning
Personalized treatment planning is formulated as a Markov Decision Process (MDP) with six possible interventions:
No intervention
Physical activity promotion
Weight management
Smoking cessation
Alcohol cessation
Medication adjustment
A Proximal Policy Optimization (PPO) agent learns optimal intervention strategies by balancing:
Cardiovascular risk reduction
Treatment cost
Side effects
Patient adherence
5. Clinical Safety
A Rule-Guided Action Masking Engine prevents clinically inappropriate recommendations by eliminating invalid actions before decision making. Additional safety is enforced using a Lagrangian-constrained PPO that penalizes unsafe treatment policies.
6. Explainable AI
The framework uses Kernel SHAP to explain:
Individual cardiovascular risk predictions.
Important clinical features influencing the prediction.
Personalized intervention recommendations.
This improves transparency and clinician confidence.
System Deployment
The complete system is deployed using:
FastAPI for backend services.
Streamlit for an interactive clinical dashboard.
SQLite for patient data storage and audit management.
The dashboard supports:
Real-time cardiovascular risk prediction.
Digital Twin simulation.
Personalized treatment recommendations.
SHAP-based explanations.
Clinical audit and visualization.
Results
Experimental evaluation demonstrates that the proposed CardioTwin framework successfully integrates:
Accurate cardiovascular risk prediction.
Dynamic patient health simulation.
Personalized intervention planning.
Clinically safe reinforcement learning.
Explainable AI.
Interactive clinical decision support.
The system provides transparent explanations alongside personalized recommendations, making it more trustworthy and suitable for practical healthcare applications.
Conclusion
We successfully developed and validated CardioTwin OS, an end-to-end multi-stage clinical decision support system. The LR-XGB Ensemble classifier achieved 78.26% Recall on the Framingham cohort, serving as a highly sensitive risk screening tool. The PyTorch GRU-Attention Digital Twin modeled patient trajectories with low error (0.032 RMSE). The Lagrangian-constrained PPO policy recommended optimal, safe, and cost-effective treatment interventions. The system\'s out-of-distribution generalizability was validated on a 70,000-row external dataset, and its codebase verified via 14 unit tests.
References
[1] R. B. D\'Agostino Sr., et al., \"General cardiovascular risk profile for use in primary care: the Framingham Heart Study,\" Circulation, vol. 117, no. 6, pp. 743-753, 2008.
[2] J. Schulman, et al., \"Proximal policy optimization algorithms,\" arXiv preprint arXiv:1707.06347, 2017.
[3] S. M. Lundberg and S.-I. Lee, \"A unified approach to interpreting model predictions,\" Advances in Neural Information Processing Systems, 2017.
[4] K. Cho, et al., \"Learning phrase representations using RNN encoder-decoder for statistical machine translation,\" arXiv preprint arXiv:1406.1078, 2014.
[5] R. S. Sutton and A. G. Barto, Reinforcement learning: An introduction. MIT Press, 2018.
[6] ACC/AHA Task Force, \"2013 ACC/AHA guideline on the assessment of cardiovascular risk,\" Journal of the American College of Cardiology, vol. 63, no. 25, pp. 2935-2959, 2013.
[7] H. Estiri, et al., \"Reinforcement Learning for Multi-Objective Optimization of Hypertension Treatment Regimes,\" Journal of the American Medical Informatics Association (JAMIA), vol. 28, no. 11, pp. 2345-2354, 2021.
[8] Y. Zhao, et al., \"Deep Reinforcement Learning for Dynamic Treatment Regimes in Lipid-Modifying Therapy,\" Journal of Biomedical Informatics, vol. 144, p. 104430, 2023.
[9] G. Gul, et al., \"Machine Learning and Ensemble Methods for Cardiovascular Disease Prediction: A Systematic Review,\" Computers, vol. 15, no. 1, p. 25, 2026.
[10] J. Smith, et al., \"Comparative Analysis of Machine Learning Classifiers for Confirmative Heart Disease Diagnostics,\" Diagnostics, vol. 15, no. 2, p. 234, 2025.