## 4 Discussion  
Although the beneficial effects of CR have been thoroughly described in several studies, the uptake and adherence to center-based or home-based CR remains suboptimal. The limited adherence to CR programs leads to implications for patients' clinical status and the effective use of resources. This study proposes an approach to predict long-term exercise adherence in a home-based CR setting, based on readily available baseline data before the start of a CR program. These data include clinical information, behavioral characteristics, and cardiovascular fitness, as well as HR and exercise duration during a familiarization phase of the intervention. Figure 12: Networks for the adherent and non-adherent clusters include data from both the adherence to the familiarization phase and the baseline clinical characteristics. The numbers inside the nodes (**upper**) represent the variable adhere during each week. The different measures for the importance of each node is depicted (**bottom**). The methodology is based on the combination of unsupervised and supervised machine learning techniques in order to predict, from the initial stages of the CR programs, those patients who are more likely to be adherent during a 6-month period. In more detail, the unsupervised methods aim to identify different patients' profiles based on clinical and behavioral characteristics, whereas supervised techniques use these profiles to make the prediction. Based on the bibliography, this is the first data-driven end-to-end method that is able to predict long-term adherence in such programs, using data that are commonly collected during CR programs. Initially, clustering was chosen as an unsupervised method to show the group characteristics at baseline and the adherence behavior in a limited familiarization period, without imposing a binary problem. The baseline data led to the formation of three patient groups, suggesting (1) a low-risk and active group of patients, (2) high-risk sedentary patients, and (3) a considerable number of patients who were of high cardiovascular risk but were also fit and motivated. The exercise familiarization showed three adherence behaviors (high adherence, low adherence, and transient adherence), while the exercise sessions after the familiarization phase led to two clusters: adherent and non-adherent. These two clusters were the targets for prediction, while the clusters based on the baseline data and the familiarization phase served as inputs for the prediction model. Two types of models were tested: (1) decision trees, and (2) RF. The first type is more interpretable but also unstable, while the second type offers both robustness and explainability. Regarding the decision trees, the most common model produced after 100 runs with 10-fold cross-validation achieved both high precision and high recall (80.2 \(\pm\) 19.5% and 94.4 \(\pm\) 14.5%, respectively), and the rules were simple and explainable. As shown in Figure 8a, only approximately 60% of the target patients were adherent. However, if a patient was adherent during the familiarization phase, the long-term adherence rates reached 90%. For the rest of the patients, their clinical profiles can help the clinical experts to identify the non-adherent ones. A similar conclusion can also be reached by the observation of Figure 8b,c. On the other hand, the RF model had lower performance (precision = 71.8 \(\pm\) 25.8% and recall = 87.7 \(\pm\) 24%), but it also revealed the importance of non-adherence during the familiarization phase and the high-risk and sedentary profile for the prediction of the whole-program adherence. Previous studies focused on groups of patients that presented clear exercise behavior in terms of adherence, while they excluded patients with intermediate behaviors from the analysis [28], thereby somewhat limiting the generalizability of the model.