{'fraction_non_alphanumeric': 0.0340891562548203, 'fraction_numerical': 0.02174919018972698, 'mean_word_length': 5.356209150326797, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Subtyping hospitalized patients with hypokalemia by machine learning consensus clustering and associated mortality risks

ABSTRACT Background Hospitalized patients with hypokalemia are heterogeneous and cluster analysis, an unsupervised machine learning methodology, may discover more precise and specific homogeneous groups within this population of interest. Our study aimed to cluster patients with hypokalemia at hospital admission using an unsupervised machine learning approach and assess the mortality risk among these distinct clusters. Methods We performed consensus clustering analysis based on demographic information, principal diagnoses, comorbidities and laboratory data among 4763 hospitalized adult patients with admission serum potassium ≤3.5 mEq/L. We calculated the standardized mean difference of each variable and used the cutoff of ±0.3 to identify each cluster's key features. We assessed the association of the hypokalemia cluster with hospital and 1-year mortality. Results Consensus cluster analysis identified three distinct clusters that best represented patients’ baseline characteristics. Cluster 1 had 1150 (32%) patients, cluster 2 had 1344 (28%) patients and cluster 3 had 1909 (40%) patients. Based on the standardized difference, patients in cluster 1 were younger, had less comorbidity burden but higher estimated glomerular filtration rate (eGFR) and higher hemoglobin; patients in cluster 2 were older, more likely to be admitted for cardiovascular disease and had higher serum sodium and chloride levels but lower eGFR, serum bicarbonate, strong ion difference (SID) and hemoglobin, while patients in cluster 3 were older, had a greater comorbidity burden, higher serum bicarbonate and SID but lower serum sodium, chloride and eGFR. Compared with cluster 1, cluster 2 had both higher hospital and 1-year mortality, whereas cluster 3 had higher 1-year mortality but comparable hospital mortality. Conclusion Our study demonstrated the use of consensus clustering analysis in the heterogeneous cohort of hospitalized hypokalemic patients to characterize their patterns of baseline clinical and laboratory data into three clinically distinct clusters with different mortality risks.

Studies have demonstrated that certain subgroups of hospitalized hypokalemic patients carry an even greater risk of mortality regardless of cause, such as patients with cardiovascular diseases (CVDs) or chronic kidney diseases (CKDs) [4,9]. However, not all patients with CVD or CKD have similar characteristics, and there are many important patient-associated factors and coexisting illnesses that may affect patient survival [10]. Patients with CVD or CKD are a heterogeneous group with variable risk associations with cardiovascular events and mortality. Studies have demonstrated that machine learning (ML) cluster analysis may identify meaningful disease subtypes and/or groups of related phenotypic variables, even in a highly selected group of patients [11,12]. Given that hospitalized patients with hypokalemia are heterogeneous [4,7], cluster analysis, an unsupervised ML methodology, may discover more precise and specific homogeneous groups within this population of interest [13,14]. The clustering approach can identify subgroups/clusters of patients with homogeneous values incorporating all variables, not just the target variable [15][16][17][18]. Thus the utilization of clustering analysis on a large hospitalized patient cohort with hypokalemia may enable us to identify clusters of patients sharing different phenotypic and clinicopathological features, which may be associated with different clinical outcomes including mortality.
In this study we aimed to explore the clustering of patients with hypokalemia on hospital admission and assess the mortality risk among these distinct clusters.

Patient population
The Mayo Clinic Institutional Review Board approved this study. We used our hospital's database to identify all adult patients (≥18 years) admitted to the Mayo Clinic Hospital from 1 January 2011 to 31 December 2013. If patients had more than one hospital admission during the study period, we analyzed only the first admission. We included patients who had hypokalemia at hospital admission. We defined admission hypokalemia as the first serum potassium measured within 24 hours of hospital admission ≤3.5 mEq/L. We excluded patients who did not have a serum potassium measurement within 24 hours of hospital admission and patients who did not provide research authorization.

Data collection
We abstracted pertinent clinical characteristics and laboratory data from our hospital's electronic database, using a previously validated method [4,7,19,20]. In brief, the Mayo Clinic Life Science System database contains demographic characteristics, hospital admissions information, diagnosis and procedure codes, laboratory test results and flow sheet data of inpatients and outpatients. Principal diagnoses were grouped based on International Classification of Diseases, 9th Revision (ICD-9) codes at admission (Supplementary data, Table S1). The Charlson comorbidity index was calculated to determine the comorbidity burden at the time of admission. The comorbid conditions were extracted from clinical notes contained within the electronic medical record using an automated electronic search algorithm [21]. Glomerular filtration rate (GFR) was estimated using the Chronic Kidney Disease Epidemiology Collaboration (CKD-EPI) equation based on age, sex, race and admission serum creatinine [22]. The anion gap (mEq/L) was calculated by serum sodium-(serum chloride + serum bicarbonate) [23]. The strong ion difference (SID; mEq/L) was calculated by (serum sodium + serum potassium)-serum chloride [23].
As our goal was to group hospitalized hypokalemic patients into clusters based on their hospital admission's demographic information, principal diagnoses, comorbidities and laboratory data, we only utilized data that were available within 24 hours of hospital admission for clustering analysis. We selected the first laboratory value within this 24-hour time frame if there were multiple measurements. We excluded variables with >20% missing data. If variables had missing data accounting for <20%, we imputed missing data through multiple imputations using random forest before their inclusion in clustering analysis.

Clustering analysis
We applied an unsupervised ML approach to develop clinical phenotypes of hospitalized patients with hypokalemia by conducting unsupervised consensus clustering [13]. We used a prespecified subsampling parameter of 80% with 100 iterations and assigned the number of potential clusters (k) to range from 2 to 10 in order to avoid producing an excessive number of clusters that would not be clinically useful. The optimal number of clusters was determined by examining the consensus matrix (CM) heat map, cumulative distribution function (CDF), clusterconsensus plots in the within-cluster consensus scores and the proportion of ambiguously clustered pairs (PAC) [24,25]. The within-cluster consensus score, ranging between 0 and 1, is defined as the average consensus value for all pairs of individuals belonging to the same cluster [25]. A value closer to 1 indicates better cluster stability [25]. PAC, ranging between 0 and 1, is calculated as the proportion of all sample pairs with consensus values falling within the predetermined boundaries [24]. A value closer to 0 indicates better cluster stability [24]. We calculated the PAC using two criteria: the strict criteria consisting of a predetermined boundary of (0, 1), where a pair of individuals who had a consensus value >0 or <1 was considered ambiguously clustered, and the relaxed criteria consisting of a predetermined boundary of (0.1, 0.9), where a pair of individuals who had a consensus value >0.1 or <0.9 was considered ambiguously clustered [24]. This study's detailed consensus cluster algorithms are provided in the online supplementary data.

Statistical analysis
After cluster identification, we performed analyses to explore differences among the clusters. We tested differences in baseline characteristics among the identified clusters using the analysis of variance (ANOVA) test for continuous variables and chi-squared test for categorical variables. To examine cluster profiles, we calculated and graphically displayed the standardized mean differences of baseline characteristics between each cluster and the overall population. We considered variables with an absolute standardized mean difference >0.3 as key features for each cluster. We hypothesized that valid, clinically distinct clusters would have measurable differences in outcomes. Hence we compared hospital mortality and 1-year mortality as outcomes of interest across the clusters. We also examined the association of clusters with hospital mortality using logistic regression and 1-year mortality using Cox proportional hazards regression. We used cluster 1 as the reference group for outcome comparison, as this cluster was associated with the lowest mortality. We did not adjust for between-group differences in baseline characteristics because these variables were used to develop the clusters through unsupervised ML. We performed all analyses using R version 4.0.3 (RStudio, Boston, MA; http://www.rstudio.com/), with the packages of ConsensusClus-terPlus (version 1.46.0) [25] for consensus clustering analysis and the missForest package for missing data imputation [26].

RESULTS
There were 147 358 hospital admissions during the study period. Of these, 31 110 were excluded due to no admission serum potassium and 39 552 due to readmission. As such, there were FIGURE 2: (A) The bar plot represents the mean consensus score for different numbers of clusters (k ranges from 2 to 10). (B) The PAC values using the strict criteria (red line) with the predetermined boundary of (0, 1) and the PAC values using the relaxed criteria (black line) with the predetermined boundary of (0.1, 0.9) as the definition for ambiguously clustered pairs. 76 696 unique hospitalized patients with available admission serum potassium. We included a total of 4763 hospitalized patients with admission hypokalemia. The mean age was 60 ± 19 years and 39% were male. The mean estimated GFR (eGFR) was 80 ± 24 mL/min/1.73 m 2 and 19% had CKD. The mean admission serum potassium was 3.2 ± 0.3 mEq/L.
The CDF plot displayed consensus distributions for each potassium level ( Figure 1A). The delta area plot shows the relative change in the area under the CDF curve ( Figure 1B). The largest changes in area occurred between k = 3 and k = 4, at which point the relative increase in area became noticeably smaller. As shown in the CM heatmap ( Figure 1C; supplementary data, Figures S1-S9), the ML algorithm identified cluster 2 and cluster 3 with clear boundaries, indicating good cluster stability over repeated iterations. The mean cluster-consensus score was comparable between the scenario 2 and 3 clusters (Figure 2A). Favorable low PACs by both strict and relaxed criteria were demonstrated for three clusters ( Figure 2B). Thus, using base-line variables at hospital admission, the consensus clustering analysis identified three clusters that best represented the data pattern of our hospitalized hypokalemic patients.
Cluster 1 had 1150 (32%) patients, cluster 2 had 1344 (28%) patients and cluster 3 had 1909 (40%) patients. Table 1 shows the baseline characteristics of the three identified clusters. The distribution of all baseline variables was significantly different between the three clusters. Of note, the mean admission serum potassium was numerically comparable across the three clusters {3.2 [standard deviation (SD) 0.2], 3.1 [SD 0.3] and 3.2 [SD 0.3] mEq/L for cluster 1, 2 and 3 respectively}, although there was a statistically significant difference (P < 0.001). Figure 3 shows the plot of the standardized mean difference to visualize the key features for each cluster. Cluster 1 patients were younger, with a lower comorbidity burden and a higher eGFR and hemoglobin. Cluster 2 patients were older, more likely to be admitted for cardiovascular diagnosis and had higher serum sodium and chloride levels but lower eGFR, serum bicarbonate, SID and hemoglobin. Cluster 3 patients were older, had a higher comorbidity burden, serum bicarbonate and SID but lower serum sodium, chloride and eGFR. Hospital mortality was 1.9% for cluster 1, 4.2% for cluster 2 and 2.3% for cluster 3 (P < 0.001) ( Figure 4A). Cluster 2 {odds ratio [OR] 2.34 [95% confidence interval (CI) 1.48-3.71]}, but not cluster 3, was significantly associated with higher hospital mortality compared with cluster 1 ( Table 2). One-year mortality was 8.0% for cluster 1, 21.4% for cluster 2 and 21.9% for cluster 3 (P < 0.001) ( Figure 4B). Both cluster 2 [OR 2.87 (95% CI 2.24-3.67)] and cluster 3 [OR 2.94 (95% CI 2.33-3.71)] were significantly associated with increased 1-year mortality compared with cluster 1 ( Table 2).

DISCUSSION
In this study we divided hospitalized patients with hypokalemia into three distinct subgroups by applying unsupervised consensus clustering analysis. This resulted in identification of different phenotypic features and prognostic differentiation, including hospital mortality and 1-year mortality. Hospital mortality and 1-year mortality varied among the clusters: 1.9% and 8.0% in cluster 1, 4.2% and 21.4% in cluster 2 and 2.3% and 21.9% in cluster 3, respectively.
The practice of medicine is advancing to more personalized care. ML methods, such as cluster analysis, offer the ability to more efficiently analyze large volumes of data to identify and classify groups of patients based on phenotypic features, thus allowing the development of targeted interventions to improve patient outcomes. In this study we successfully demonstrated the ability to identify clinically important groupings by unsupervised ML consensus clustering, which may have potential implications for the management of hospitalized patients with hypokalemia.
Hypokalemic patients in cluster 2 had the highest in-hospital mortality among the three groups. Furthermore, patients in this group also had reduced 1-year survival when compared with cluster 1. Characteristics of hypokalemic patients in cluster 2 included older age, principal diagnosis of CVD, anemia, reduced GFR, hyperchloremic metabolic acidosis and hypernatremia ( Figure 3). Previous studies with traditional statistics have demonstrated that hypokalemia is associated with increased risks of in-hospital mortality, ventricular arrhythmias and FIGURE 3: The standardized differences across three clusters for each of the baseline parameters. The x axis is the standardized differences value and the y axis shows baseline parameters. The dashed vertical lines represent the standardized differences cutoffs of <−0.3 and >0.3. AG, anion gap; BMI, body mass index; Cl, chloride; CHF, congestive heart failure; COPD, chronic obstructive pulmonary disease; CVA, cerebrovascular accident; DM, diabetes mellitus; ESKD, end-stage kidney disease; GI, gastrointestinal; Hb, hemoglobin; ID, infectious disease; HCO3, bicarbonate; K, potassium; MI, myocardial infarction; Na, sodium; PVD, peripheral vascular disease. cardiac arrest, especially among CVD and CKD patient populations [4,7,[27][28][29][30][31][32]. In addition to CKD and CVD, additional phenotypic features of patients in cluster 2 included anemia, hyperchloremic metabolic acidosis and hypernatremia. Given that patients with these phenotypes carried higher in-patient and 1-year mortality, future studies are needed to identify strategies to identify those at risk to improve outcomes among this patient population.
Cluster 3 consists of older patients with a high comorbidities burden and an eGFR that falls between cluster 1 and cluster 2. These patients also had high SID (increased HCO 3 − or decreased H + ), which usually occurs in the settings of serum chloride loss or serum sodium gain. Since serum sodium in this cluster is lower than in other clusters, these hypokalemic patients in cluster 3 likely had phenotypes of metabolic alkalosis with chloride depletion. This phenotype of metabolic alkalosis with chloride depletion was not identified in the other clusters. Clinically this is often observed in the setting of vomiting/nasogastric suction, bulimia, chloruretic effect of diuretics and post-hypercapnic state [33,34]. Despite not reaching statistical significance, patients in cluster 3 had a higher hospital mortality rate compared with patients in cluster 1 (which is comprised of younger adult patients with the lowest comorbidities burden and highest eGFR among the three clusters). These patients in cluster 3 had reduced 1-year survival compared with patients in cluster 1, but comparable to that of patients in cluster 2. Thus hypokalemic patients with phenotypic features of cluster 3 may require close post-hospitalization follow-up to reduce 1-year mortality risk. There were some limitations to our current study. First, although we used a large dataset, the data from our study are from a single center. Hence the clustering may be unique to our patient population (which is predominantly non-Hispanic white). Second, we performed ML clustering at the time of hospital admission. The workup for hypokalemic patients in the outpatient setting or throughout their hospitalization may include studies that evaluate for potassium transcellular shifts versus urinary loss versus gastrointestinal loss. This  testing includes, but is not limited to, plasma aldosterone and renin levels, serum magnesium and calcium levels, spot urine samples for the ratio of urine potassium to urine creatinine or urinary chloride and 24-hour urine studies [35,36]. Given that these laboratory investigations were not commonly performed on admission (even serum magnesium levels were missing in >20% of patients), these data were limited and thus were not included in our ML clustering algorithm. However, our clustering approach at the time of hospital admission may provide potential implications for the early management of hospitalized patients with distinct phenotypes of hypokalemia. Lastly, data on electrocardiograms and medications that are common causes of hypokalemia, such as thiazide and loop diuretics, were limited in our database. Thus future studies are needed to assess whether these variables could have improved the discriminatory ability of the groupings we identified. In summary, we present the first clustering analysis of hospitalized patients with hypokalemia performed to date. The findings of our study allow selection of phenotypic and clinicopathological features in three unique clusters that may be of consequence for the development of hypokalemia and its associated survival outcomes. Cluster 2 identified hypokalemic patients with a phenotype of older age, principal diagnosis of CVD, anemia, reduced GFR, hyperchloremic metabolic acidosis and hypernatremia that had increased in-hospital and 1-year mortality. Patients in cluster 3 had higher 1-year mortality but comparable hospital mortality compared with cluster 1. These findings may potentially help classify hospitalized patients with hypokalemia on admission, thus translating to an improved personalized precision medicine approach.

SUPPLEMENTARY DATA
Supplementary data are available at ckj online.