# Clustering of Heart Failure Phenotypes in Johannesburg Using Unsupervised Machine Learning
## 3 Results
### Cluster Analysis  
The agglomerative clustering hierarchical algorithm identified three clusters of heart failure patients (Figure 2). Cluster 1 (_uraemic cluster_) comprised 229 (36.0%) patients with a mean age of 56.2 \(\pm\) 17.2 years (Table 3). Patients in Cluster 1 had a relatively higher mean LVEF of 45 \(\pm\) 17.6 (\(p\) < 0.001). Forty-six (50.5%) patients with HFmEF were in cluster 1 and 83 (61.0%) patients with HFpEF were also in cluster 1. The patients in the _uraemic cluster_ also had a smaller mean left ventricular internal diameter in end-systole (LVIDs) of 4.1 \(\pm\) 1.3 cm (\(p\) < 0.001) and mean left ventricular internal diameter end-diastole (LVIDd) of 5.2 \(\pm\) 1.1 cm. \begin{table}
\begin{tabular}{c c c c c c} \hline
**Algorithm** & **2 Clusters** & **3 Clusters** & **4 Clusters** & **5 Clusters** & **6 Clusters** \\ \hline K-prototype & 0.580 & 0.100 & 0.120 & 0.120 & 0.120 \\ K-means & 0.036 & 0.042 & 0.048 & 0.048 & 0.048 \\ Agglomerative & 0.640 & 0.720 & 0.680 & 0.540 & 0.580 \\ BIRCH & 0.030 & 0.020 & 0.022 & 0.023 & 0.026 \\ Gaussian mixture & 0.580 & 0.580 & 0.570 & 0.550 & 0.460 \\ \hline \end{tabular} BIRCH = Balanced Iterative Reducing and Clustering Hierarchies. Ordering Points To Identify the Clustering Structure (OPTICS) and density-based spatial clustering of applications with noise (DBSCAN) algorithms were not included since they were unsuccessful in clustering the data. DBSCAN and OPTICS algorithms generated an optimum number of clusters as one and zero, respectively.  
\end{table} 
Table 1: Number of clusters vs. silhouette score for the algorithms used in the study. Figure 1: Flow chart showing heart failure patient selection for clustering. Figure 2: _Cont_. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline \multirow{2}{*}{**Clinical Parameters**} & **All Patients** & **HFrEF** & **HFmEF** & **HFpEF** & **-Value** \\  & **(_n = 636_)** & **(_n = 409_)** & **(_n = 91_)** & **(_n = 136_)** & _p-Value_ \\ \hline Age (years), mean & 55.6 \(\pm\) 16.9 & 54.6 \(\pm\) 16.9 & 58.0 \(\pm\) 17.1 & 56.9 \(\pm\) 16.4 & 0.1183 \\ Male sex, n (\%) & 352 (55.3) & 218 (61.9) & 53 (15.1) & 81 (23.0) & 0.3720 \\ Ethnicity, n (\%) & & & & & \\ African & 380 (59.7) & 251 (66.1) & 49 (12.9) & 80(21.1) & 0.4038 \\ Caucasian & 154 (24.2) & 93 (60.4) & 31 (20.1) & 30 (19.5) & 0.0595 \\ Indian & 72 (11.3) & 46 (63.9) & 8 (11.1) & 18 (25.0) & 0.5831 \\ Mixed ancestry & 29 (4.6) & 19 (65.5) & 3 (10.3) & 7 (24.1) & 0.7992 \\ Clinical examination & & & & & \\ Lung crepitations & 392 (61.6) & 251 (64.0) & 60 (15.3) & 81 (20.7) & 0.6153 \\ Ascites & 144 (22.6) & 90 (62.5) & 20 (13.9) & 34 (23.6) & 0.7597 \\ Cyanosed & 51 (8.0) & 32 (62.5) & 2 (13.9) & 17 (23.6) & 0.7597 \\ Hepatomegaly & 249 (39.2) & 173 (69.5) & 36 (14.5) & 40 (16.1) & 0.0284 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Baseline demographic and clinical characteristics of the study patients stratified according to the left ventricular ejection fraction. Figure 2: Clusters of heart failure patients identified by agglomerative clustering. (**A**) Dendrogram showing three clusters. Cluster 1 (orange), cluster 2 and 3 (green). Three clusters were selected based on the silhouette score of 0.7, which is a measure of goodness of fit of patients into each cluster. The x-axis shows various clusters, and the y-axis shows the average distance between clusters. (**B**) A two-dimensional scatterplot of the three clusters of heart failure patients identified by the agglomerative clustering algorithm. The x- and y-axis represent principal component 1 and 2, respectively. Each component represents a constellation of clinical features that were used to cluster data points.