# Clinical Utility of the Automatic Phenotype Annotation in Unstructured
Clinical Notes: ICU Use Cases

Jingqing Zhang  Data Science Institute, Imperial College London, London, SW7
2AZ, UK  Pangaea Data Limited, UK, USA  These authors contributed equally to
this work.  Luis Bolanos  Pangaea Data Limited, UK, USA  These authors
contributed equally to this work.  Ashwani Tanwar  Pangaea Data Limited, UK,
USA  These authors contributed equally to this work.  Julia Ive  Department of
Computing, Imperial College London, London, SW7 2AZ, UK  Queen Mary University
of London, London, E1 4NS, UK  Vibhor Gupta  Pangaea Data Limited, UK, USA
Yike Guo  Data Science Institute, Imperial College London, London, SW7 2AZ, UK
Hong Kong Baptist University, Hong Kong SAR, China  Pangaea Data Limited, UK,
USA  Correspondence to<EMAIL_ADDRESS>
###### Abstract

#### Objective

Clinical notes contain information not present elsewhere, including drug
response and symptoms, all of which are highly important when predicting key
outcomes in acute care patients. We propose the automatic annotation of
phenotypes from clinical notes as a method to capture essential information,
which is complementary to typically used vital signs and laboratory test
results, to predict outcomes in the Intensive Care Unit (ICU).

#### Methods

We develop a novel phenotype annotation model to annotate phenotypic features
of patients which are then used as input features of predictive models to
predict ICU patient outcomes. We demonstrate and validate our approach
conducting experiments on three ICU prediction tasks including in-hospital
mortality, physiological decompensation and length of stay for over 24,000
patients by using MIMIC-III dataset.

#### Results

The predictive models incorporating phenotypic information achieve 0.845 (AUC-
ROC) to predict in-hospital mortality, 0.839 (AUC-ROC) for physiological
decompensation and 0.430 (Kappa) for length of stay, all of which consistently
outperform the baseline models leveraging only vital signs and laboratory test
results. Moreover, we conduct a thorough interpretability study, showing that
phenotypes provide valuable insights at the patient and cohort levels.

#### Conclusion

The proposed approach demonstrates phenotypic information complements
traditionally used vital signs and laboratory test results, improving
significantly forecast of outcomes in the ICU.

## Summary

What is already known?

  * •

Previous works have demonstrated good performance for prediction of outcomes
in the Intensive Care Unit (ICU) using bedside measurements and laboratory
test results

  * •

Contextual embeddings from recent Transformer-based Natural Language
Processing models have enabled a more accurate detection of medical concepts

What does this paper add?

  * •

This paper introduces a new methodology to incorporate contextualized
phenotypic features from clinical text and their persistency into the
modelling of ICU time-series prediction tasks

  * •

We conduct an interpretability study, illustrating why and how phenotypic
features are highly relevant for ICU outcomes prediction

## Introduction

The accumulation of healthcare data today has reached unprecedented levels:
NHS datasets alone record billions of patient interactions every year [1]. In
particular, due to the close monitoring of patients in an Intensive Care Unit
(ICU), a wealth of data is generated for each patient[2], with some
information being recorded every minute.

In the typical setting, an Electronic Health Record (EHR) contains two types
of information, which are structured (e.g. blood tests, temperature, lab
results) and unstructured information (e.g. nursing notes, radiology reports,
discharge summaries), with the latter composing the biggest part (typically,
up to 80% [3]). Both types of information are valuable for the ICU monitoring.
The majority of recent research [4, 5, 6] relies though on more
straightforward structured information, typically being laboratory test
results and vital signs.

Among the unstructured data, the phenotype111In the medical text, the word
“phenotype” refers to deviations from normal morphology, physiology, or
behaviour [7]. has been received the least attention for the ICU monitoring
[8]. This is mainly due to the challenge to extract the phenotypic information
expressed by a variety of contextual synonyms. For example, such a phenotype
as Hypotension can be expressed in text as “drop in blood pressure” and “BP of
79/48”. However, the phenotypes are crucial for understanding disease
diagnosis, identifying important disease-specific information, stratifying
patients and identifying novel disease subtypes [9].

Our work thoroughly investigates the value of phenotypic information as
extracted from text for ICU monitoring. We automatically extract mentions of
phenotypes from clinical text using a self-supervised methodology with recent
advancements in clinical NLP - contextualized word embeddings [10] that are
particularly helpful for the detection of contextual synonyms. We extract
those mentions for over 15,000 phenotype concepts of the Human Phenotype
Ontology (HPO) [11]. We enrich the phenotypic features extracted in this
manner with the information coming from the structured data (i.e., bedside
measurements and laboratory test results). To provide interpretation into our
results we use SHAP values[12].

We benchmark our approach on the following three mainstream ICU tasks
following the practice [4] for comparison: length of stay, in-hospital
mortality and physiological decompensation.

Our main contributions are: (i) approach to incorporate phenotypic features
into the modelling of ICU time-series prediction tasks; (ii) investigation of
the importance of the phenotypic features in combination with structured
information for the prediction of patient course at micro (individual patient)
and macro (cohort) levels; (iii) thorough interpretability study demonstrating
the importance of phenotypic features and structured features for the ICU
cases; (iv) demonstration of the utility of automatic phenotyping for ICU use
cases.

## Methodology

###  0.1 Data preprocessing

In this study, we use the publicly available ICU database MIMIC-III [13] and
follow the common practice [4] to define the three ICU tasks, data collection
and data preprocessing. We formulate the in-hospital mortality problem as a
binary classification at 48 hours after admission, in which the label
indicates whether the patient dies before discharge. We formulate the problem
of physiological decompensation as a binary classification, in which the
target label corresponds to whether the patient will die in the next 24 hours.
We cast the length of stay (LOS) prediction task as a multi-class
classification problem, where the labels correspond to the remaining length of
stay. Possible values are divided into 10 bins, one for the stays of less than
a day, 7 bins for each day of the first week, another bin for the stays of
more than a week but less than two, and the final bin for stays of more than
two weeks.

For data collection, we use both structured data (e.g. bedside measurements)
and unstructured data (e.g. clinical notes) following the filtering criteria
[4] for the patients, admissions and ICU stays in all three tasks. In
addition, we discard all the ICU episodes in which a clinical note is not
recorded. This reduces our train and test data as compared to the benchmark
[4], so we recalculate the baseline scores using their code on our new test
set for fair comparison. Overall, there are over 24,000 patients in total and
the exact numbers of patients, ICU episodes and timesteps per task are
reported in Table A1. Mortality rate across all patients is 13.12% and
decompensation rate across all timesteps is 2.01%. Most patients stay in ICU
less than 7 days, and the distribution of ICU stays per LOS class is presented
in detail in Table A2.

For data preprocessing of structured data, we follow the steps222Accessed in
November 2021: https://github.com/YerevaNN/mimic3-benchmarks to collect 17
clinical features (i.e., capillary refill rate, diastolic blood pressure,
fraction inspired oxygen, Glasgow coma scale eye opening, Glasgow coma scale
motor response, Glasgow coma scale verbal response, Glasgow coma scale total,
glucose, heart rate, height, mean blood pressure, oxygen saturation,
respiratory rate, systolic blood pressure, temperature, weight, and pH). For
data preprocessing of unstructured data, we collect all clinical notes
including nursing notes, physician notes and discharge summaries at all
timesteps during ICU stays and we observe there is high data sparsity as
clinical notes are recorded roughly every 12 hours. The processed structured
data and unstructured data are then used as inputs to our approach.

### Algorithm development and analysis

The proposed approach consists of two steps. The first step is to collect
clinical features (more specifically, phenotypic features, standardised by
Human Phenotype Ontology (HPO) [11]) from unstructured data by using Natural
Language Processing (NLP) algorithms. The second step is to combine the
phenotypic features from unstructured data and the 17 clinical features from
structured data as input features for machine learning classifiers to predict
in-hospital mortality, physiological decompensation and LOS in separate.

First, to extract phenotypes from free-text clinical notes, we develop a
state-of-the-art phenotyping model, which leverages contextualized word
embeddings and data augmentation techniques (paraphrasing and synthetic text
generation) to capture names, synonyms, abbreviations and, more importantly,
contextual synonyms of phenotypes. For example, “drop in blood pressure” and
“BP of 79/48” are both contextual synonyms of Hypotension (HP:0002615). As a
result of the contextual detection of phenotype, the phenotyping model
demonstrates superior performance than alternative phenotyping algorithms. We
refer the readers to the work [14] for methodological details. For comparison,
we also use alternative phenotyping methods including ClinicalBERT [10] (fine-
tuned for phenotyping) and NCR [15]. NCR uses a convolutional neural network
(CNN) to assign similarity scores to HPO concepts of phrases encoded by using
pre-trained non-contextualized word embeddings.

Second, the phenotypic features are combined with structured clinical features
together as input features to machine learning classifiers for prediction of
the three ICU tasks. We use standard machine learning classifiers: Random
Forest (RF) [16], and Long Short-Term Memory Network (LSTM) [17] for
prediction. We distinguish the phenotypic features between persistent and
transient ones to reduce feature sparsity. More precisely, if a phenotype is
clinically deemed likely to last an entire admission in the vast majority of
typical cases (e.g., tuberculosis, cancer), it is marked as ‘persistent’. In
contrast, if the phenotype can be acquired or improved during an ICU stay,
such as pain, fever, cough, it is marked as ‘transient’. We make transient and
persistent phenotypes present from the moment it appears until a new clinical
note appears, and until the end of the ICU stay, respectively. We find this
beneficial and will discuss it in Section Phenotype persistency. We also
address data sparsity by aggregating HPO terms into their parents (according
to the HPO hierarchy).

### Evaluation Metrics

To compare with the previous study [4], we use Area Under the Curve of
Receiver Operating Characteristic (AUC-ROC) [18] and Area Under the Curve of
Precision-Recall (AUC-PR) for In-Hospital Mortality and Physiological
Decompensation tasks. We primarily rely on AUC-ROC for statistical analysis as
it is threshold independent and used by the benchmark [4] as the primary
metric. For the LOS task, we use Cohen’s Kappa [19] and Mean Absolute
Deviation [20] (MAD) with primarily relying on the Kappa scores for
statistical analysis.

### Model evaluation and statistical analysis

We use a train-test split based on the benchmark[4], but exclude patients
without clinical notes, resulting in 21,346 and 3,824 patients for train and
test set, respectively. Further, we perform 4-fold cross validation on the
training set. All splits are deterministic, so that all the classifiers with
different data settings are trained and evaluated with the same subsets of
data. We use the bootstrap resampling following the benchmark for statistical
analysis of the scores. To compute confidence intervals on the test set we
resample it 1,000 times for length of stay and decompensation, and 10,000
times for in-hospital mortality task. Then, we compute the scores on the
resampled data to calculate 95% confidence intervals.

To provide interpretability and insights into model predictions, we use SHAP
values[12], the implementation details of which are explained more in Appendix
Shapley Values. The SHAP values are typically used to explain black box
models, and allow us to quantify the importance of a feature and whether it
impacts positively or negatively the outcome.

## Results

### Phenotyping

Across all three tasks, ClinicalBERT finds 664 phenotypes, NCR finds 1,441
phenotypes, and our methodology finds 1,446, in average. 30% of these
phenotypes are persistent (on average across tasks).

### Quantitative results

In general, we investigate the performance of two classifiers: Random Forest
(RF) and LSTM. For each of them we investigate the following set of features:
structured features only (S) and structured features enriched with phenotypic
features coming from one of the three phenotype annotators (ClinicalBERT, NCR,
ours).

The main results are presented in Table 1 and the results from statistical
tests are presented in Table A4. Overall, they show that phenotypic
information complements positively the structured information to improve
performance on all tasks. The improvements with our phenotyping model are
statistically significant across all tasks compared against using structured
features only or alternative phenotyping algorithms, except for In-Hospital
Mortality with RF.

This is explained by the fact that phenotypes carry highly valuable
information, including response to therapy, development of complication,
comorbidities and unmeasured indicators of illness severity, all of which are
fundamental to correctly estimate the LOS and mortality risk of a patient [21,
22].

Classification Model | Features Design | AUC-ROC $\uparrow$ | AUC-PR $\uparrow$
---|---|---|---
SAPS-II | - | 0.756 | 0.312
APACHE-III | - | 0.733 | 0.308
Random Forest | S | 0.800 (0.775, 0.824) | 0.339 (0.286, 0.395)
S + NCR | 0.828 (0.802, 0.853) | 0.467 (0.404, 0.529)
S + CB | 0.812 (0.787, 0.838) | 0.403 (0.345, 0.463)
S + Ours | 0.845 (0.826, 0.873) | 0.462 (0.404, 0.524)
LSTM | S [4] | 0.825 | 0.410
S | 0.826 (0.801, 0.848) | 0.391 (0.334, 0.452)
S + NCR | 0.841 (0.818, 0.864) | 0.453 (0.393, 0.513)
S + CB | 0.826 (0.802, 0.849) | 0.414 (0.355, 0.476)
S + Ours | 0.845 (0.823, 0.868) | 0.464 (0.405, 0.523)
(a) In-hospital mortality

Classification Model | Features Design | AUC-ROC $\uparrow$ | AUC-PR $\uparrow$
---|---|---|---
Random Forest | S | 0.826 (0.821, 0.831) | 0.130 (0.123, 0.138)
S + NCR | 0.825 (0.821, 0.830) | 0.124 (0.118, 0.131)
S + CB | 0.826 (0.821, 0.830) | 0.125 (0.118, 0.132)
S + Ours | 0.845 (0.840, 0.850) | 0.180 (0.171, 0.190)
LSTM | S [4] | 0.809 | 0.125
S | 0.824 (0.819, 0.829) | 0.126 (0.119, 0.133)
S + NCR | 0.834 (0.829, 0.839) | 0.134 (0.127, 0.142)
S + CB | 0.833 (0.828, 0.838) | 0.114 (0.108, 0.119)
S + Ours | 0.839 (0.834, 0.844) | 0.145 (0.138, 0.153)
(b) Physiological decompensation

Classification Model | Features Design | Kappa $\uparrow$ | MAD $\downarrow$
---|---|---|---
Random Forest | S | 0.390 (0.388, 0.392) | 136.8 (136.2, 137.4)
S + NCR | 0.390 (0.388, 0.392) | 142.5 (141.9, 143.1)
S + CB | 0.376 (0.374, 0.379) | 144.3 (143.7, 144.9)
S + Ours | 0.420 (0.418, 0.422) | 110.3 (109.3, 111.3)
LSTM | S [4] | 0.395 | 126.7
S | 0.380 (0.377, 0.382) | 157.0 (156.3, 157.6)
S + NCR | 0.406 (0.404, 0.408) | 123.3 (122.8, 123.9)
S + CB | 0.388 (0.386, 0.390) | 120.1 (119.6, 120.6)
S + Ours | 0.430 (0.427, 0.432) | 116.7 (116.1, 117.2)
(c) Length of Stay

Table 1: Results for (a) In-Hospital Mortality, (b) Physiological
Decompensation, and (c) Length of Stay. Test set scores are shown with 95%
confidence intervals in brackets if applicable. The best score for each
classifier is highlighted in bold. The first row of LSTM refers to scores
reported in previous literature, while the second row regards scores reproduce
in this study with a comparable cohort. Here, S refers to Structured, NCR to
Neural Concept Recognizer[15], CB to ClinicalBERT, and Ours to our phenotyping
model.

## Discussion

While we conclude that phenotypic information provides useful information to
correctly conduct the three ICU tasks, decision support systems in the
healthcare domain should be reliable, interpretable and robust. Therefore, we
accompany the above results with a thorough study on interpretability,
providing explanations both at the patient and cohort levels for the observed
predictions, and an assessment of robustness by studying performances across
disease-specific sub-cohorts.

### Phenotype persistency

We find it beneficial to propagate phenotypes forwards in time. More
precisely, each phenotypes is marked by one human clinical expert based on
whether it would typically persist throughout an entire ICU stay or not.
Consequently, transient (e.g., fever, cough, dyspnea) and persistent (e.g.,
diabetes, cancer) phenotypes are propagated until the appearance of a new
clinical note or the end of the ICU stay, respectively. We perform an ablation
study and observe the phenotype propagation is more beneficial to Random
Forest (RF) than LSTM. The RF models with phenotype propagation achieve 4.6%
higher AUC-ROC for in-hospital mortality, 2.5% higher AUC-ROC for
decompensation and 3.4% higher Kappa for LOS than RF without phenotype
propagation. However, the LSTM models with phenotype propagation achieve 1.4%
higher AUC-ROC for in-hospital mortality, comparable results for
decompensation and 1.1% lower Kappa for LOS. We hypothesise this is because
LSTM by design can better capture temporal relationship given a large amount
of data to learn from. The full results can be found in Table A6. We believe
further investigation focused on learning persistency of phenotypes would be
beneficial, not only to boost prediction accuracy, but also to provide
insights about temporal duration of phenotypes in the ICU.

### Phenotype importance

To further understand the contribution of phenotypic features to the
prediction performance, we have studied the most important features with the
help of SHAP values[12]. This analysis and all involving SHAP values are
conducted on the Random Forest (RF) models. An illustration of our
investigation is in Figure 1, where we present the top predicting features for
in-hospital mortality and physiological decompensation. It confirms that
phenotypic features are particularly helpful for the in-hospital mortality
prediction, given that 13 out of the 20 most important features are
phenotypes. This is explained by the fact that forecasts need to rely on
information that is able to provide insights accurately into the long-term
future.

Contrary to bedside measurements which may not correlate well with future
outcomes due to their dynamic nature, phenotypes are highly informative given
that they capture, for instance, comorbidities, which are essential for
predicting mortality [22]. Furthermore, another study [23] including 230,000
ICU patients found that combining the comorbidities with acute physiological
measurements yielded the best results, outperforming all mortality scores
(APACHE-II, SAPS-II).

Unexpectedly and interestingly, the top ranking feature for mortality
prediction is whether the patient experiences pain or not. We observe also
that the second top ranking feature is Constitutional symptom (HP:0025142).
Noting this is actually the resulting phenotype after aggregating all of its
children, this phenotype should be interpreted not as a textual mention in the
patient’s EHR of the broad term, but rather as a mention of any of its
children (most notably generalized pain). Consequently, the second top feature
again highlights the importance of pain.

Although not decisive, there is some initial evidence corroborating the fact
that pain management improves outcomes in the ICU [24]. However, pain could
also be interpreted as a proxy for establishing a high level of consciousness,
which has been correlated with better outcomes in the ICU [25].

The other top ranking phenotypes, such as atrial arrhythmia, and nausea and
vomiting, cover most of the body systems (i.e., heart, lungs, GI tract,
central nervous system, coagulation, infection, kidneys) which are typically
assessed through clinically validated scores e.g., APACHE, SAPS.

(a) In-Hospital Mortality

(b) Physiological Decompensation

Figure 1: Top features for in-hospital mortality and physiological
decompensation . Features are sorted in decreasing importance according to
their mean absolute SHAP values. Each row presents a condensed summary of the
feature’s impact on the prediction. Each data sample is represented as a
single dot in each row, and its colour on a particular row represents the
value of that sample for that feature, with blue corresponding to lower values
or absence, and red to higher ones or presence. The SHAP value (horizontal
position of a dot) measures the contribution of that feature on a sample,
towards the prediction (right corresponding to mortality or decompensation,
and left to survival or out of decompensation risk). For instance, in (a) top
row, since the vertical axes clearly splits patients by colour, manifesting
HP:0012531 Pain consistently leads to lower chances of dying.

Our study also showed that though phenotypic features are not as important for
decompensation as for in-hospital mortality (only 3 out of the top 20 features
for this task were phenotypic ones), they are still useful because they
provide a better estimation of the predicted risk. Given that this task
concerns predicting mortality within the next 24 hours, bedside measurements
become more informative thanks to their temporal correlation (also shown in
Figure A3). Nevertheless, bedside measurements can be ambiguous or provide an
incomplete picture of the patient’s status without the data found in clinical
notes. For example, for one patient Neoplasm of the respiratory system
(HP:0100606) was found to be the top feature, and although this phenotype is
persistent, it increases appropriately the risk of decompensation, giving
overall a better estimation. An illustration of this patient is shown by
Figure A4.

Similarly, the top features for long length-of-stay (more than 1 week) are
presented in Figure A1 where we notice 10 of 20 top features are phenotypes.

### Calibration

Calibration of machine learning models compares the distribution of the
probability predicted by models with the distribution of probabilities
observed in real data (e.g. real patients). To measure model calibration, we
use the Brier score[26] (the lower the better). Our investigation of the
respective calibration curves (see Figure 2 and Figure A2) shows that
phenotypes from unstructured notes improve model calibration across setups,
especially for physiological decompensation and in-hospital mortality, which
means the distribution predicted by models is closer to real distribution of
patients. Besides, LSTM overall also produces better calibration than RF.

(a) Physiological Decompensation

(b) In-hospital Mortality

Figure 2: Calibration curves with LSTM for (a) physiological decompensation
and (b) in-hospital mortality. Calibration curves are presented with its Brier
score (the lower the better). Note that overall inclusion of phenotypic
features from unstructured data helps with calibration. LSTM in legend refers
to using structured features only. Ours, NCR, CB: phenotypic features from our
phenotyping model, NCR and ClinicalBERT, respectively.

### Prognosis analysis

Beyond producing clinically relevant explanations at the cohort level, with
the help of SHAP values we can shed light onto a patient’s journey and
discover retrospectively when the patient was the most vulnerable and why. For
example, the fragment of a patient’s LOS forecast in Figure 3 illustrates an
estimated probability, after 41 hour from admission, of a LOS longer than 14
days being of 69%, mainly because the patient scored 1 in the Glasgow Coma
Scale Verbal Response. One hour after, when a clinical note becomes available,
worrisome phenotypes appear (including edema, hypotension and abnormality of
the respiratory system). Consequently, the estimated probability increases to
88%.

Figure 3: Illustrative case for an ICU length of stay of more than 14 days.
Top plot: time course of the normalised predicted probability for a stay of
more than 14 days, and feature heatmap for a representative segment of the ICU
stay. Each row of the heatmap represents one of the top features. At each time
step, a feature can contribute positively (red) or negatively (blue) for
predicting a stay of 14 days or more. Black horizontal bars at the right of
each row represent the importance of the features. Note that a new clinical
note that is available at the 42nd hour (vertical dashed line) leads to an
increase confidence of longer stay due to new features. Bottom plot:
Inspection of the contributing features at the 41st and 42nd hours. Each force
plot illustrates features contributing positively (red) and negatively (blue)
to the prediction of a longer stay. Probability of long stay increases from
69% to 88% when the clinical note provides critical information.

### Cohort study

We assess performance of our approach to the cohorts of the patients with
different diseases especially underrepresented diseases to understand its
robustness and generalisability. The test set is split into four disease-
specific cohorts for patients with cardiovascular diseases, diabetes, cancer,
and depression, and then the accuracies of the best LSTM models (using
structured features and phenotypic features) are reported individually for
each cohort on each ICU task. We notice the patient number of cardiovascular
diseases or diabetes is at least twice that of cancer and around five times
that of depression.

For in-hospital mortality and physiological decompensation, we observe
comparable accuracies across the four cohorts. We report the range of AUC-ROC
between 0.780 and 0.826 for in-hospital mortality and between 0.792 and 0.820
for physiological decompensation for the four cohorts. In contrast, for LOS,
we observe lower Kappa 0.321 and 0.330 for small cohorts cancer and
depression, respectively, as opposed to 0.413 and 0.424 for larger cohorts
with cardiovascular diseases and diabetes. We hypothesise the nature of
diseases has strong implication on in-hospital mortality and physiological
decompensation while LOS can be influenced by more factors which require
larger data samples to model their interactions. The full results are
available in Table A7.

## Limitations

We have investigated only one data source, MIMIC-III, and our observations are
to be confirmed with other data sources.

The analysis on phenotype importance is produced on the Random Forest, whose
accuracy is superior than the baselines but not as good as LSTM. This is
limited by the poor computation efficiency of SHAP values for LSTM and the
explanations from neural network based models are to be investigated in future
studies.

Moreover, the phenotypes annotated as transient are made present only until a
new clinical note appears in the timeline. This has the inconvenience that
phenotypes might be prematurely considered as not present because the next
available clinical note did not mention them. Even though the LSTM classifier
is able to learn temporal correlations on its own, a more elaborated feature
modelling could prove useful.

## Acknowledgements

We would like to thank Dr. Rick Sax, Dr. Garima Gupta and Dr. Matt Wiener for
their feedback throughout this research. We would also like to thank Dr.
Garima Gupta, Dr. Deepa (M.R.S.H) and Dr. Ashok (M.S.) for helping us create
gold-standard phenotype annotation data.

## Author contributions

JZ, LB, AT and JI conceived the experiments. LB and AT conducted the
experiments. JZ, LB, AT, and JI analysed the results. JI, VB and YG reviewed
the research and manuscript. All authors approved the manuscript.

## Additional information

Competing interests: This study is under collaboration with Imperial College
London, Queen Mary University of London, Hong Kong Baptist University and
Pangaea Data Limited.

## References

  * [1] Nhs digital annual report and accounts 2019 to 2020 (2020).
  * [2] Johnson, A. E. _et al._ Machine learning and decision support in critical care.  _Proceedings of the IEEE_ 104, 444–466, DOI: 10.1109/JPROC.2015.2501978 (2016).
  * [3] Kong, H. J.  Managing unstructured big data in healthcare system.  _Healthcare Informatics Research_ 25, 1–2, DOI: 10.4258/hir.2019.25.1.1 (2019).
  * [4] Harutyunyan, H., Khachatrian, H., Kale, D. C., Ver Steeg, G. & Galstyan, A.  Multitask learning and benchmarking with clinical time series data.  _Scientific data_ 6, 1–18 (2019).
  * [5] Subudhi, S. _et al._ Comparing machine learning algorithms for predicting icu admission and mortality in covid-19.  _npj Digital Medicine_ 4, 87, DOI: 10.1038/s41746-021-00456-x (2021).
  * [6] Alves, T., Laender, A., Veloso, A. & Ziviani, N.  Dynamic prediction of icu mortality risk using domain adaptation.  In _2018 IEEE International Conference on Big Data (Big Data)_ , 1328–1336, DOI: 10.1109/BigData.2018.8621927 (2018).
  * [7] Robinson, P. N.  Deep phenotyping for precision medicine.  _Human mutation_ 33, 777–780 (2012).
  * [8] Cooley-Rieders, K. & Zheng, K.  Physician documentation matters. using natural language processing to predict mortality in sepsis.  _Intelligence-Based Medicine_ 5, 100028, DOI: 10.1016/j.ibmed.2021.100028 (2021).
  * [9] Liu, C. _et al._ Ensembles of natural language processing systems for portable phenotyping solutions.  _Journal of Biomedical Informatics_ 100, 103318, DOI: https://doi.org/10.1016/j.jbi.2019.103318 (2019).
  * [10] Alsentzer, E. _et al._ Publicly Available Clinical {BERT} Embeddings.  In _Proceedings of the 2nd Clinical Natural Language Processing Workshop_ , 72–78, DOI: 10.18653/v1/W19-1909 (Association for Computational Linguistics, Minneapolis, Minnesota, USA, 2019).
  * [11] Köhler, S. _et al._ The human phenotype ontology in 2021\.  _Nucleic Acids Research_ 49, D1207–D1217, DOI: 10.1093/nar/gkaa1043 (2021).
  * [12] Lundberg, S. M. & Lee, S.-I.  A unified approach to interpreting model predictions.  In Guyon, I. _et al._ (eds.) _Advances in Neural Information Processing Systems_ , vol. 30 (Curran Associates, Inc., 2017).
  * [13] Johnson, A. E. _et al._ Mimic-iii, a freely accessible critical care database.  _Scientific Data_ 3, 1–9, DOI: 10.1038/sdata.2016.35 (2016).
  * [14] Zhang, J. _et al._ Self-supervised detection of contextual synonyms in a multi-class setting: Phenotype annotation use case.  In _Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing_ , 8754–8769 (Association for Computational Linguistics, Online and Punta Cana, Dominican Republic, 2021).
  * [15] Arbabi, A., Adams, D. R., Fidler, S. & Brudno, M.  Identifying clinical terms in medical text using ontology-guided machine learning.  _JMIR medical informatics_ 7, e12596 (2019).
  * [16] Breiman, L.  Random forests.  _Machine Learning_ 45, 5–32, DOI: 10.1023/A:1010933404324 (2001).
  * [17] Hochreiter, S. & Schmidhuber, J.  Long short-term memory.  _Neural Computation_ 9, 1735–1780, DOI: 10.1162/neco.1997.9.8.1735 (1997).
  * [18] Lasko, T. A., Bhagwat, J. G., Zou, K. H. & Ohno-Machado, L.  The use of receiver operating characteristic curves in biomedical informatics.  _Journal of Biomedical Informatics_ 38, 404–415, DOI: 10.1016/j.jbi.2005.02.008 (2005).
  * [19] Cohen, J.  A coefficient of agreement for nominal scales.  _Educational and Psychological Measurement_ 20, 37–46, DOI: 10.1177/001316446002000104 (1960).
  * [20] Pham-Gia, T. & Hung, T. L.  The mean and median absolute deviations.  _Mathematical and Computer Modelling_ 34, 921–936, DOI: 10.1016/S0895-7177(01)00109-1 (2001).
  * [21] Kramer, A. A.  Are icu length of stay predictions worthwhile?  _Critical Care Medicine_ 45, 379–380, DOI: 10.1097/CCM.0000000000002111 (2017).
  * [22] Forte, J. C. & van der Horst, I. C.  Comorbidities and medical history essential for mortality prediction in critically ill patients.  _The Lancet Digital Health_ 1, e48–e49, DOI: 10.1016/S2589-7500(19)30030-5 (2019).
  * [23] Nielsen, A. B. _et al._ Survival prediction in intensive-care units based on aggregation of long-term disease history and acute physiology: a retrospective study of the danish national patient registry and electronic patient records.  _The Lancet Digital Health_ 1, e78–e89, DOI: 10.1016/S2589-7500(19)30024-X (2019).
  * [24] Georgiou, E., Hadjibalassi, M., Lambrinou, E., Andreou, P. & Papathanassoglou, E. D.  The impact of pain assessment on critically ill patients’ outcomes: A systematic review.  _BioMed Research International_ 2015, DOI: 10.1155/2015/503830 (2015).
  * [25] Bastos, P. G., Sun, X., Wagner, D. P., Wu, A. W. & Knaus, W. A.  Glasgow coma scale score in the evaluation of outcome in the intensive care unit: Findings from the acute physiology and chronic health evaluation iii study.  _Critical Care Medicine_ 21, 1459–1465, DOI: 10.1097/00003246-199310000-00012 (1993).
  * [26] BRIER, G. W.  Verification of forecasts expressed in terms of probability.  _Monthly Weather Review_ 78, 1 – 3, DOI: 10.1175/1520-0493(1950)078<0001:VOFEIT>2.0.CO;2 (1950).
  * [27] Lundberg, S. M. _et al._ From local explanations to global understanding with explainable ai for trees.  _Nature Machine Intelligence_ 2, 56–67, DOI: 10.1038/s42256-019-0138-9 (2020).

## Appendix

### Shapley Values

Shapley values come from game theory and are used to estimate the impact of a
feature on a system’s output. Feature impact is defined as the variation in
the output of the model when the feature is observed versus when it is
unknown.

Shapley values belong to a category of methods denominated additive. In
particular, the additivity is formulated as

$\begin{split}f(x)&=\phi_{0}(f,x)+\sum_{i=1}^{M}\phi_{i}(f,x)\end{split}$

where $f(x)$ is the prediction made by the model, $x$ are the features fed to
the model, $M$ is the number of features, $\phi_{i}$ is the Shapley value of
the i-th feature, and $\phi_{0}=E[f(x)]$ is the expected value of the model
over the training dataset. Also, this assumption ensures the values correctly
reflect the difference between the expected model output and the output for a
particular prediction.

The Shapley value of a feature is computed via

$\begin{split}\phi_{i}(f,x)&=\sum_{S\subseteq
S_{all}/\\{i\\}}\frac{|S|!(M-|S|-1)!}{M!}[f_{x}(S\cup\\{i\\})-f_{x}(S)]\\\
&=\sum_{S\subseteq S_{all}/\\{i\\}}\frac{1}{(M\text{ choose
}|S|)(M-|S|)}[f_{x}(S\cup\\{i\\})-f_{x}(S)]\end{split}$ (1)

where $S$ is a subset of all $M$ input features, and $f_{x}(S)=E[f(x)|x_{s}]$
with $x_{s}$ in a subset of the input features with only those belonging to
$S$ present.

In this study we used the SHAP library [12] and its optimisation for tree-
based classifiers [27] to compute the Shapley values.

###  .2 Data distribution by splits

| Counts |
---|---|---
Task | Split | Patients | ICU Episodes | Timesteps | Labels |
Positive | Negative |
Physiological Decompensation | CV-1 | 5125 | 6215 | 528425 | 10283 | 518142 |
CV-2 | 5129 | 6134 | 507892 | 10821 | 497071 |
CV-3 | 5141 | 6264 | 511289 | 10426 | 500863 |
CV-4 | 5102 | 6297 | 527853 | 11020 | 516833 |
Test | 3683 | 4463 | 367533 | 6931 | 360602 |
In-Hospital Mortality | CV-1 | 2929 | 3382 | 162063 | 441 | 2941 |
CV-2 | 2917 | 3331 | 159566 | 466 | 2865 |
CV-3 | 2888 | 3356 | 160732 | 439 | 2917 |
CV-4 | 2936 | 3410 | 163284 | 477 | 2933 |
Test | 2119 | 2453 | 117500 | 283 | 2170 |
Length of Stay | CV-1 | 5151 | 6245 | 532403 | Refer to Table A2 |
CV-2 | 5145 | 6154 | 510227 |
CV-3 | 5160 | 6286 | 514147 |
CV-4 | 5117 | 6314 | 530331 |
Test | 3698 | 4483 | 369350 |
Table A1: Data distribution by splits. For the physiological decompensation
and length of stay tasks, timesteps are taken as samples as the predictions
are made every hourly timesteps, while for the in-hospital mortality task, ICU
episodes are taken as samples as the predictions are made at a fixed timestep.
Here, CV refers to the training Cross-Validation Folds.

###  .3 Class distribution for length of stay

Class Label | Class Description (Days) | CV-1 | CV-2 | CV-3 | CV-4 | Test
---|---|---|---|---|---|---
0 | <1 | 131913 | 129634 | 131693 | 133186 | 95439
1 | 1 - 2 | 85311 | 83558 | 84065 | 85818 | 61372
2 | 2 - 3 | 56353 | 54074 | 54007 | 54780 | 38858
3 | 3 - 4 | 39416 | 37605 | 38106 | 38054 | 27142
4 | 4 - 5 | 29384 | 27982 | 28760 | 28573 | 20171
5 | 5 - 6 | 22830 | 22384 | 22360 | 22626 | 15878
6 | 6 - 7 | 18816 | 18612 | 18626 | 18582 | 12940
7 | 7 - 8 | 15925 | 15583 | 15697 | 15863 | 10953
8 | 8 - 14 | 62655 | 58512 | 59905 | 60611 | 40856
9 | >14 | 69800 | 62283 | 60928 | 72238 | 45741
Total |  | 532403 | 510227 | 514147 | 530331 | 369350
Table A2: Class distribution for Length of Stay

### Algorithm hyperparameters

Classifier |  Hyperparameters
---|---
Random Forest |  num of estimators=300, criterion="gini", max depth=None, min samples split=2, min samples leaf=1
LSTM |  epochs=30, hidden size=128, batch size=8, num of layers=1, patience=10, dropout rate=0, learning rate=1e-4, weight decay=0.0
Table A3: Hyperparameters for classifiers

### Significance tests

ML Classification Model |  Base Model | Secondary Models
---|---|---
S |  | S +
---
NCR
| S +
---
CB
| S +
---
Ours
Random Forest | S | - | 1 | 13.25 | 0
S + NCR | 99 | - | 94.82 | 26.13
S + CB | 86.75 | 5.18 | - | 1.07
S + Ours | 100 | 73.87 | 98.93 | -
LSTM | S | - | 0 | 0 | 0
S + NCR | 100 | - | 100 | 0
S + CB | 100 | 0 | - | 0
S + Ours | 100 | 100 | 100 | -

(a) In-Hospital Mortality

ML Classification Model |  Base Model | Secondary Models
---|---|---
S |  | S +
---
NCR
| S +
---
CB
| S +
---
Ours
Random Forest | S | - | 81.4 | 69 | 0
S + NCR | 18.6 | - | 32.4 | 0
S + CB | 31 | 67.6 | - | 0
S + Ours | 100 | 100 | 100 | -
LSTM | S | - | 0 | 0 | 0
S + NCR | 100 | - | 73 | 0
S + CB | 100 | 27 | - | 0
S + Ours | 100 | 100 | 100 | -

(b) Physiological Decompensation

ML Classification Model |  Base Model | Secondary Models
---|---|---
S |  | S +
---
NCR
| S +
---
CB
| S +
---
Ours
Random Forest | S | - | 22.1 | 100 | 0
S + NCR | 77.9 | - | 100 | 0
S + CB | 0 | 0 | - | 0
S + Ours | 100 | 100 | 100 | -
LSTM | S | - | 0 | 0 | 0
S + NCR | 100 | - | 100 | 0
S + CB | 100 | 0 | - | 0
S + Ours | 100 | 100 | 100 | -

(c) Length of Stay

Table A4: Statistical Significance Matrix with Bootstrap Resampling. All the
scores are percentages of samples where the base model performs better than
the secondary model. Each sample is built by resampling the original test set
and then scoring the base/secondary model on it. For example, the last row in
(a) shows the base model (LSTM with S + Ours) is better than the secondary
models (LSTM with S or S + NCR or S + CB) on 100% samples (i.e. with
statistical significance). Here, S refers to Structured, NCR to Neural Concept
Recognizer[15], CB to ClinicalBERT, and Ours to our phenotyping model.

### 4-Fold cross validation results

Classification Model | Features Design | 4-Fold Cross Validation Aggregate
---|---|---
AUC-ROC | AUC-PR
| Mean | SD | Mean | SD
SAPS-II | - | 0.754 | 0.006 | 0.322 | 0.031
APACHE-III | - | 0.732 | 0.008 | 0.326 | 0.018
Random Forest | S | 0.810 | 0.008 | 0.418 | 0.018
S + NCR | 0.819 | 0.014 | 0.472 | 0.013
S + CB | 0.804 | 0.012 | 0.423 | 0.005
S + Ours | 0.834 | 0.008 | 0.477 | 0.016
LSTM | S | - | - | - | -
S | 0.829 | 0.007 | 0.441 | 0.016
S + NCR | 0.836 | 0.011 | 0.478 | 0.008
S + CB | 0.829 | 0.007 | 0.459 | 0.007
S + Ours | 0.845 | 0.004 | 0.496 | 0.014
(a) In-hospital mortality

Classification Model | Features Design | 4-Fold Cross Validation Aggregate
---|---|---
AUC-ROC | AUC-PR
Mean | SD | Mean | SD
Random Forest | S | 0.815 | 0.003 | 0.127 | 0.009
S + NCR | 0.820 | 0.003 | 0.125 | 0.007
S + CB | 0.818 | 0.004 | 0.123 | 0.008
S + Ours | 0.844 | 0.004 | 0.165 | 0.013
LSTM | S | - | - | - | -
S | 0.819 | 0.003 | 0.136 | 0.016
S + NCR | 0.820 | 0.003 | 0.134 | 0.013
S + CB | 0.821 | 0.006 | 0.128 | 0.022
S + Ours | 0.833 | 0.008 | 0.144 | 0.023
(b) Physiological decompensation

Classification Model | Features Design | 4-Fold Cross Validation Aggregate
---|---|---
Kappa | MAD
Mean | SD | Mean | SD
Random Forest | S | 0.381 | 0.005 | 142.010 | 4.665
S + NCR | 0.382 | 0.008 | 148.003 | 4.180
S + CB | 0.369 | 0.005 | 149.221 | 3.789
S + Ours | 0.405 | 0.006 | 116.940 | 5.674
LSTM | S | - | - | - | -
S | 0.375 | 0.003 | 134.373 | 17.293
S + NCR | 0.393 | 0.013 | 127.165 | 17.484
S + CB | 0.374 | 0.015 | 127.678 | 8.608
S + Ours | 0.416 | 0.012 | 116.198 | 6.904
(c) Length of Stay

Table A5: Results for (a) In-Hospital Mortality, (b) Physiological
Decompensation, and (c) Length of Stay on the training set. The best score for
each classifier is highlighted in bold. Here, S refers to Structured, NCR to
Neural Concept Recognizer[15], CB to ClinicalBERT, and Ours to our phenotyping
model.

###  .4 Ablation study on phenotype persistency

Model |  Phenotypic propagation | 4-fold Cross Validation Aggregate | Test Set
---|---|---|---
AUC-ROC | AUC-PR | AUC-ROC | AUC-PR
Mean | SD | Mean | SD
RF | without | 0.807 | 0.008 | 0.413 | 0.021 | 0.799 (0.772, 0.824) | 0.351 (0.297, 0.407)
with | 0.834 | 0.008 | 0.477 | 0.016 | 0.845 (0.826, 0.873) | 0.462 (0.404, 0.524)
LSTM | without | 0.833 | 0.014 | 0.457 | 0.024 | 0.831 (0.807, 0.853) | 0.421 (0.361, 0.483)
with | 0.844 | 0.004 | 0.495 | 0.013 | 0.845 (0.823, 0.868) | 0.464 (0.405, 0.523)
(a) In-hospital Mortality

Model |  Phenotypic propagation | 4-fold Cross Validation Aggregate | Test Set
---|---|---|---
AUC-ROC | AUC-PR | AUC-ROC | AUC-PR
Mean | SD | Mean | SD
RF | without | 0.812 | 0.002 | 0.125 | 0.007 | 0.820 (0.815, 0.825) | 0.127 (0.120, 0.135)
with | 0.844 | 0.004 | 0.165 | 0.013 | 0.845 (0.840, 0.850) | 0.180 (0.171, 0.190)
LSTM | without | 0.827 | 0.007 | 0.146 | 0.017 | 0.841 (0.842, 0.851) | 0.149 (0.141, 0.156)
with | 0.833 | 0.007 | 0.144 | 0.022 | 0.839 (0.834, 0.844) | 0.145 (0.138, 0.153)
(b) Physiological Decompensation

Model |  Phenotypic propagation | 4-fold Cross Validation Aggregate | Test Set
---|---|---|---
Kappa | MAD | Kappa | MAD
Mean | SD | Mean | SD
RF | without | 0.376 | 0.005 | 139.8 | 5.5 | 0.386 (0.380, 0.384) | 135.0 (134.5, 135.6)
with | 0.405 | 0.006 | 116.9 | 5.6 | 0.420 (0.418, 0.422) | 110.3 (109.3, 111.3)
LSTM | without | 0.427 | 0.007 | 118.3 | 4.2 | 0.441 (0.439, 0.440) | 111.4 (110.9, 111.9)
with | 0.416 | 0.012 | 116.2 | 6.9 | 0.430 (0.427, 0.432) | 116.7 (116.2, 117.3)
(c) Length of Stay

Table A6: Results of ablation study on our phenotyping model to assess the
importance of phenotypic modelling. Models without phenotypic propagation
encounter high sparsity of phenotypes as data is only available at the
timestep the clinical note is written. Models with phenotypic propagation
observe phenotypes throughout all timesteps. The best score for each
classifier is highlighted in bold.

### Feature importance for Length-of-Stay

Figure A1: Top features for length-of-stay predicting stays of more than 1
week.

### Calibration curves

(a) Physiological Decompensation

(b) In-hospital Mortality

Figure A2: Calibration curves with Random Forest for (a) physiological
decompensation and (b) in-hospital mortality. RF in legend refers to using
structured features only. Ours, NCR, CB: phenotypic features from our
phenotyping model, NCR and ClinicalBERT, respectively.

###  .5 Cohort study

Cohort | No. of Patients | No. of ICU Episodes | AUC-ROC
---|---|---|---
All | 2119 | 2453 | 0.845
Cardiovascular Diseases | 681 | 789 | 0.780
Diabetes | 563 | 682 | 0.826
Cancer | 277 | 304 | 0.822
Depression | 119 | 122 | 0.783

(a) In-hospital Mortality.

Cohort | No. of Patients | No. of ICU Episodes | AUC-ROC
---|---|---|---
All | 3683 | 4463 | 0.839
Cardiovascular Diseases | 975 | 1197 | 0.792
Diabetes | 927 | 1191 | 0.808
Cancer | 489 | 565 | 0.806
Depression | 216 | 240 | 0.820

(b) Physiological Decompensation.

Cohort | No. of Patients | No. of ICU Episodes | Kappa
---|---|---|---
All | 3698 | 4483 | 0.430
Cardiovascular Diseases | 980 | 1202 | 0.413
Diabetes | 930 | 1195 | 0.424
Cancer | 493 | 572 | 0.321
Depression | 216 | 241 | 0.330

(c) Length of Stay

Table A7: Analysing the generalisability and robustness of our approach on
cohorts with different diseases. The accuracies of the best LSTM models which
use features from both structured and unstructured data are reported
individually on each cohort for each ICU task.

###  .6 Forecasts per total length of stay

(a) Physiological Decompensation

(b) In-hospital Mortality

Figure A3: AUCROC for (a) physiological decompensation and (b) in-hospital
mortality for LSTM for patients with different LOS values. While the in-
hospital mortality task benefits consistently for any duration of the ICU
stay, decompensation sees the best improvements when patients stay the
longest. This behaviour is a natural consequence of the fact that while near
future forecasts can rely strongly on bedside measurements, forecasting
without a fixed endpoint in time is significantly more difficult.
Nevertheless, patients who stayed for less than two weeks still saw a benefit
when introducing phenotypic features, as they calibrate better the algorithm’s
prediction. Here, S represents structured features and Ours refers to
phenotypes from our phenotyping model.

###  .7 Case study for physiological decompensation

Figure A4: Time course of the physiological decompensation prediction for an
illustrative patient in the test set. The top plot represents the time series
of the prediction in probability (0 for no risk of decompensation, 1 for
decompensation). The heatmap illustrates how the contribution of each feature
(i.e., each row) varies across time for this subject. Features are sorted in
decreasing order according to their importance for this patient, represented
by the black horizontal bar at the right of each row. The colour of a row
indicates how that feature contributes to the prediction at a moment in time,
with red representing a positive contribution (i.e., that the patient will
decompensate), and blue for a negative contribution. For this patient,
although fluctuations in the prediction come from changes in structured data,
taking into account the neoplasm of the respiratory system allows to better
estimate the baseline risk of decompensation.


11institutetext: TU Eindhoven, PO Box 513, 5600MB, The Netherlands, 11email:
<EMAIL_ADDRESS><EMAIL_ADDRESS>
# A hybrid DEIM and leverage scores based method for CUR index selection

Perfect Y. Gidisu and Michiel E. Hochstenbach

###### Abstract

The discrete empirical interpolation method (DEIM) may be used as an index
selection strategy for formulating a CUR factorization. A notable drawback of
the original DEIM algorithm is that the number of column or row indices that
can be selected is limited to the number of input singular vectors. We propose
a new variant of DEIM, which we call L-DEIM, a combination of the strength of
deterministic leverage scores and DEIM. This method allows for the selection
of a number of indices greater than the number of input singular vectors.
Since DEIM requires singular vectors as input matrices, L-DEIM is particularly
attractive for example in big data problems when computing a rank-$k$ SVD
approximation is expensive even for moderately small $k$ since it uses a
lower-rank SVD approximation instead of the full rank-$k$ SVD. We empirically
demonstrate the performance of L-DEIM, which despite its efficiency, may
achieve comparable results to the original DEIM and even better approximations
than some state-of-the-art methods.

###### Keywords:

L-DEIM, CUR decomposition, low-rank approximation, subset selection, leverage
scores, DEIM

##  1 Introduction

Data sets are often represented by large matrices. In recent times, with the
growth of the internet (industrial) data matrices are big and may be hard to
manage. Examples of such data sets include text documents, customer databases,
stocks, and financial transactions. In many data analyses, we need dimension
reduction and for many applications, we need interpretable dimension reduction
of which a CUR decomposition is one form. A CUR factorization is a low-rank
matrix approximation proposed as an alternative to the TSVD to ensure
interpretability and preserve relevant properties like sparsity or
nonnegativity of the underlying matrix. A rank-$k$ CUR decomposition of an
$m\times n$ matrix $A$ has the form

$A\approx CMR=AP\cdot M\cdot S^{T}A,$

where $C\in{\mathbb{R}}^{m\times k}$ and $R\in{\mathbb{R}}^{k\times n}$ are
subsets of the columns and rows of $A$, respectively. The matrices
$P\in{\mathbb{R}}^{n\times k}$ and $S\in{\mathbb{R}}^{m\times k}$ are index
selection matrices with some columns of the identity indicating the columns
and rows that are picked. The matrix $M$ is constructed to minimize the
approximation error. There are several variants of this decomposition, which
implies that the three factors are not necessarily unique. In Sorensen ;
Mahoney the authors present algorithms for a CUR factorization based on a
rank-$k$ singular value decomposition. Sorensen and Embree Sorensen propose a
CUR approximation using a discrete interpolation method (DEIM) on the rank-$k$
singular vectors. The index selection method DEIM has first been introduced in
the context of model order reduction Chaturantabut . In Sorensen , it is shown
to be a viable index selection method for identifying the most representative
and influential subset of columns and rows that define a low-dimensional space
of the data. The DEIM-induced CUR requires the computation of the SVD or its
approximation. A notable limitation of this index selection algorithm is that
the number of indices that can be selected is limited to the number of
available singular vectors. In an attempt to address this, we propose a new
extension called L-DEIM. The L-DEIM scheme combines the strengths of
deterministic leverage scores sampling papailiopoulos2014 and the DEIM
procedure. Our new approach is an alternative index selection method that is
particularly attractive in a setting (for example big data problems) where we
want a rank-$k$ CUR decomposition and computing a rank-$k$ SVD approximation
is expensive even for moderately small $k$. This new algorithm allows us to
select $k$ indices without having to compute the full rank-$k$ SVD by using a
lower-rank SVD approximation instead. It may be viewed as an approach to reuse
the same information to further improve the approximation.

We denote 2-norm by $\lVert{\cdot}\rVert$. We use MATLAB notation to index
vectors and matrices; thus, $A(:,p)$ denotes the $k$ columns of $A$ whose
corresponding indices are in vector $p\in{\mathbb{N}}_{+}^{k}$.

##  2 Related Works

In this section, we briefly review some state-of-the-art deterministic
algorithms for a CUR decomposition. These algorithms have been developed for
the column subset selection problem or interpolative decomposition, but can be
generalized for a CUR decomposition. We derive our proposed algorithm L-DEIM
by combining two of the algorithms.

###  2.1 Standard DEIM

The DEIM is a discrete variant of the empirical interpolation method for
approximating systems of nonlinear ordinary differential equations. In a
recent paper by Sorensen and Embree Sorensen , the authors use this method in
the formulation of a CUR decomposition. The DEIM algorithm requires a full
rank-$k$ SVD of $A$ to select at most $k$ column and or row indices of $A$. To
illustrate how the indices are selected via the DEIM index selection method,
we first define a projector which the authors in Chaturantabut called an
interpolatory projector. Suppose we want to preserve $k$ rows of $A$ and we
have the rank-$k$ approximation of $A$ as

$\vspace{-1mm}\begin{array}[]{ccccc}A&\approx&U&&F,\\\\[-1.42262pt] m\times
n&&m\times k&&k\times n\end{array}\vspace{-1mm}$

where $U$ contains the top $k$ left singular vectors. The matrix $F$ is a
coefficient matrix to be defined such that the above approximation preserves
exactly the desired $k$ rows of $A$. Let ${\mathbf{s}}\in{\mathbb{N}}_{+}^{k}$
be an index vector with unique entries from the row index set {$1,\dots,m$} of
$A$. Now let $S\in{\mathbb{R}}^{m\times k}$ be an index selection matrix with
some columns of the identity matrix that selects certain rows of $A$, i.e.,
$S=I(:,{\mathbf{s}})$. Assuming we want to keep desired rows in ${\mathbf{s}}$
in the approximation, viz., $S^{T}A\approx S^{T}(UF)$. If $S^{T}U$ is
nonsingular, the coefficient matrix $F$ can be determined uniquely;
$F=(S^{T}U)^{-1}S^{T}\\!A$. This implies $A\approx
U(S^{T}U)^{-1}S^{T}\\!A=\mathbb{S}A$. The operator $\mathbb{S}$ is the DEIM
interpolatory projector, an oblique projector. The name interpolatory comes
from the fact that the projected matrix $\mathbb{S}A$ matches $A$ in the
${\mathbf{s}}$ entries. Note that we can obtain a similar projector using the
right singular vectors. The DEIM algorithm processes the left singular vectors
sequentially starting with the first dominant singular vector. Each step
considers the next singular vector to obtain the next index. The selected
indices are used to compute the interpolatory projector $\mathbb{S}$. The next
index is selected by removing the direction of the interpolatory projection in
the previous vectors from the subsequent one and finding the index of the
entry with the largest magnitude in the residual vector (for more details see
Sorensen ).

In Drmac , Drmac and Gugercin proposed the Q-DEIM; a variant of DEIM which
runs a column pivoted QR factorization on the transposes of the right and left
singular vectors to select the column and row indices, respectively.

###  2.2 Deterministic Leverage Score Sampling

Part of the new extension borrows an idea from the leverage scores of a matrix
$A$, which is defined below. We denote the $i$th row of $V_{k}$ by
$[V_{k}]_{i,:}$.

###### Definition 1

Given a matrix $A\in{\mathbb{R}}^{m\times n}$ with rank$(A)\geq k$, let
$V_{k}$ contain its $k$ leading right singular vectors. The rank-$k$ leverage
score of the $i$th column of $A$ is

$\ell_{i}=\lVert{[V_{k}]_{i,:}}\rVert^{2},\quad i=1,\dots,n.$

The deterministic leverage score sampling procedure selects columns of $A$
corresponding to the indices of the largest leverage scores for a given $k$.
This deterministic column selection method proposed by Jolliffe
jolliffe1972discarding is one of the first column subset selection algorithms.
The leverage score sampling algorithm can extract at least $k$ column indices
of $A$ and the upper bound on the number of indices that can be selected is
not immediate. For more details on the algorithm and the bound on the number
of columns to be sampled see, (papailiopoulos2014, , Sect. 3.1).

##  3 L-DEIM

We now introduce the new extension of DEIM. Our starting point is the method
from the earlier work Sorensen , which derives a rank-$\widehat{k}$ CUR
factorization by applying DEIM to the $\widehat{k}$ singular vectors. Given
the promising results of this algorithm compared to other state-of-the-art
methods for a CUR approximation, our proposed algorithm builds on the DEIM
procedure. Constructing a rank-$\widehat{k}$ CUR decomposition using L-DEIM
requires a rank-$k$ singular vectors where $\widehat{k}>k$. The integer $k$ is
the number of available (approximate) singular vectors, while $\widehat{k}$ is
the number of indices to be selected. To select the $\widehat{k}$ indices, the
proposed method performs the original DEIM to find the first $k$ indices while
keeping the residual singular vector in each index selection step of the DEIM
procedure. The residual singular vector is the error between the input
singular vector and its approximation from interpolating the previous singular
vectors at the selected indices; as in line 2 of Algorithm 1111Note that the
backslash operator used in the algorithm is a Matlab type notation for solving
linear systems and least-squares problems.. At the end of the iteration, using
the idea of leverage scores, we compute the 2-norm of the rows of the residual
singular vectors to select the additional $\widehat{k}-k$ indices. The
procedure is summarized in Algorithm 1. Note that the vectors in $U$ in line 3
of Algorithm 1 are the residual singular vectors and not the original singular
vectors.

Algorithm 1: L-DEIM index selection

Input: $U\in{\mathbb{R}}^{m\times k}$ and $V\in{\mathbb{R}}^{n\times k}$,
target rank = $\widehat{k}$, with $k\leq\widehat{k}\leq\min(m,n)$
Output: column and row indices
${\mathbf{s}},{\mathbf{p}}\in{\mathbb{N}}_{+}^{k}$, respectively, with non-
repeating entries
for $j=1,\dots,k$ 1: M ${\mathbf{s}}(j)$ = $\text{argmax}_{1\leq i\leq
m}~{}|(U(:,j))_{i}|$ 2: M
$U(:,j+1)=U(:,j+1)-U(:,~{}1:j)\cdot(U({\mathbf{s}},1:j)\ \backslash\
U({\mathbf{s}},j))$ 3: Compute $\ell_{i}=\lVert{[U]_{i:}}\rVert$ for
$i=1,\dots,m$; sort $\ell$ in non-increasing order 4: Remove entries in $\ell$
corresponding to the indices in ${\mathbf{s}}$ 5:
${\mathbf{s}}^{\prime}=\widehat{k}-k$ indices corresponding to $\widehat{k}-k$
largest entries of $\ell$ 6:
${\mathbf{s}}=[{\mathbf{s}};~{}{\mathbf{s}}^{\prime}]$ 7: Perform 1–6 on $V$
to get index set ${\mathbf{p}}$

From Algorithm 1, if $\widehat{k}=k$ then the algorithm reduces to the
standard DEIM. We note that if the target rank is not specified, given $k$, we
can select at least $k$ indices but the upper bound on the number of indices
to be selected is not immediate; we can select an arbitrary number of indices.
Similar to leverage scores sampling, the L-DEIM allows for oversampling of
columns and or rows.

Error bounds. Let us consider a fixed matrix $A\in{\mathbb{R}}^{m\times n}$
with rank $\rho\leq\min(m,n)$. For an arbitrary $k$ with $1\leq k\leq\rho$,
the best rank-$k$ approximation of $A$ $(A_{k})$ provided by the SVD gives
$\lVert{A-A_{k}}\rVert=\sigma_{k+1}(A)$ where $\sigma_{k+1}$ is the $(k+1)$st
singular value of $A$. Suppose that we have a known target rank $k<\min(m,n)$,
a good rank-$\widehat{k}$ approximation $A_{\widehat{k}}$ gives
$\lVert{A-A_{\widehat{k}}}\rVert\leq\tau\ \lVert{A-A_{k}}\rVert$, where
$\tau>0$ is a modest tolerance and $k\leq\widehat{k}\leq r$ is the rank of the
decomposition with oversampling. The following result unifies the theoretical
bound results for $\lVert{A-CMR}\rVert$ in (Sorensen, , Sect. 4) and
(Hendryx2021, , Append. 1).

###### Proposition 1

(See (Sorensen, , Sect. 4), (Hendryx2021, , Append. 1)) Given
$A\in{\mathbb{R}}^{m\times n}$ and $1\leq k\leq\widehat{k}\leq\min(m,n)$, let
$S\in{\mathbb{R}}^{m\times\widehat{k}}$,
$P\in{\mathbb{R}}^{n\times\widehat{k}}$ be index selection matrices and the
top $k$ left and $right$ singular vectors be $U\in{\mathbb{R}}^{m\times k}$
and $V\in{\mathbb{R}}^{n\times k}$, respectively. Let
$C=AP\in{\mathbb{R}}^{m\times\widehat{k}}$ and
$R=S^{T}A\in{\mathbb{R}}^{n\times\widehat{k}}$ be of full rank, assuming we
compute $M$ as $(C^{T}C)^{-1}C^{T}A\ R^{T}\\!(RR^{T})^{-1}$ and $S^{T}U$ and
$V^{T}P$ are of full rank we have

$\lVert{A-CMR}\rVert=[\sigma_{\min}^{-1}(V^{T}P)+\sigma_{\min}^{-1}(S^{T}U)]\cdot\sigma_{k+1}.$

The above error bounds suggest the index selection method which minimizes the
quantities $\sigma_{\min}^{-1}\ (V^{T}P)$ and $\sigma_{\min}^{-1}\ (S^{T}U)$
are theoretically desirable.

##  4 Experiments

We perform some experiments to compare the approximation quality and runtimes
of the new method L-DEIM with the existing deterministic methods discussed in
section 2. We use the relative error $\lVert{A-CMR}\rVert/\lVert{A}\rVert$ and
runtimes for selecting the column and row indices as the evaluation criteria.
Note that the runtimes reported here do not include the time for computing the
singular vectors. We run the algorithms on three real data sets used in
Sorensen ; Mahoney . The application domains of the data sets are Internet
term document analysis, genetics, and collaborative filtering. The Internet
term document data is from the Technion Repository of Text Categorization
Datasets (TechTC). We use test 26, which consists of a collection of 139
documents on two topics with 15210 terms describing each document gabrilovich
. As in Sorensen , the $139\times 15210$ TechTC matrix rows are scaled to have
a unit 2-norm. We take the cancer genetics data set GSE10072 from National
Institutes of Health ncbi . This data set has 107 patients described by 22283
probes. There are 58 patients with tumors and 49 without. We center the
$22283\times 107$ genetics data matrix by subtracting the mean of each row
from the entries in that row. The final data set is the Jester joke data set
eigentaste , which is often used as a benchmark for recommender system
research. The data matrix consists of 73421 users and their ratings for 100
jokes. We only consider users who have ratings for all 100 jokes. We center
the resulting $14116\times 100$ matrix by subtracting the mean of each column
from all entries in that column.

From figure 1, we see that the approximation quality of the proposed method
L-DEIM is as good as the original DEIM while the L-DEIM enjoys favorable
runtimes. Both DEIM and L-DEIM have considerably lower approximation error
than the other methods, with Q-DEIM almost always performing worse. The
leverage scores sampling using two singular vectors seems to be the most
efficient; however, we note that there is a trade-off between the runtimes and
approximation quality. We show results of the leverage scores method using
only the leading two singular vectors since higher choices yield worse
approximation results.

$10$$20$$30$$40$$50$$0.2$$0.4$$0.6$$0.8$$1$$|$$|$ A - CMR
$|$$|$/$|$$|$A$|$$|$DEIMLS(2)L-DEIM(25)Q-DEIM

$10$$20$$30$$40$$50$$0.2$$0.4$$0.6$$0.8$$1$

$10$$20$$30$$40$$50$$0.4$$0.6$$0.8$$1$

$10$$20$$30$$40$$50$$0$$0.1$$0.2$time (s) (a) Jester jokes data

$10$$20$$30$$40$$50$$0$$0.1$$0.2$$0.3$$0.4$ (b) Cancer genetics data

$10$$20$$30$$40$$50$$0$$0.1$$0.2$$0.3$ (c) TechTC text data

Figure 1: The approximation quality (first row) and runtimes (second row) of
the L-DEIM scheme compared with the standard DEIM, Q-DEIM, and leverage scores
sampling techniques using the three real data sets. Displayed are the relative
errors $\lVert{A-CMR}\rVert/\lVert{A}\rVert$ and runtimes as a function of
rank $k$.

##  5 Conclusions

We have presented a new extension of the DEIM index selection algorithm
(L-DEIM) to identify additional indices for constructing a rank-$\widehat{k}$
CUR decomposition using a lower-rank SVD approximation. This is especially
useful in a setting (for example big data problems) where computing a full
rank-$\widehat{k}$ SVD is relatively expensive. The algorithm may be viewed
not only as an extension of DEIM but also as an alternative index selection
method for a CUR factorization. The L-DEIM procedure may also be suitable for
point selection in the context of model order for nonlinear dynamical systems.
Although the proposed algorithm is computationally more efficient than the
original DEIM, experiments show that the approximation accuracy of both
methods may be comparable when the target rank $\widehat{k}$ is at most twice
the available $k$ singular vectors. For all results presented in section 4, we
assume that given a target rank $\widehat{k}$, $2k=\widehat{k}$ in Algorithm
1. From experiments not presented here, if $\widehat{k}>2k$ in Algorithm 1,
then the rank-$\widehat{k}$ CUR approximation quality of the L-DEIM procedure
which uses $k$ singular vectors may generally be worse than the
rank-$\widehat{k}$ CUR factorization quality of the standard DEIM scheme which
requires $\widehat{k}$ singular vectors. However, we stress that the L-DEIM is
considerably cheaper. A code for L-DEIM is available on
github.com/perfectyayra/L-DEIM-index-selection.

Acknowledgement: This work has received funding from the European Union’s
Horizon 2020 research and innovation programme under the Marie Skłodowska-
Curie grant agreement No 812912.

## References

  * (1) S. Chaturantabut and D. C. Sorensen:  Nonlinear model reduction via discrete empirical interpolation, SIAM J. Sci. Comput. 32 (2010), pp. 2737–2764.
  * (2) Z. Drmac and S. Gugercin:  A New selection operator for the discrete empirical interpolation method—improved a priori error bound and extensions, SIAM J. Sci. Comput.38 (2016), pp. A631–A648.
  * (3) E. Gabrilovich and S. Markovitch (2004) Data from: Technion Repository of Text Categorization Datasets. gabrilovich.com/resources/data/techtc/
  * (4) K. Goldberg et al. (2001) Data from: UC Berkeley AutoLab. eigentaste.berkeley.edu/dataset/
  * (5) E. P. Hendryx, B. M. Rivière and C. G. Rusin: An extended DEIM algorithm for subset selection and class identification, Mach. Learn., 110(4) (2021), pp. 621–650.
  * (6) I. T. Jolliffe:  Discarding variables in a principal component analysis. I: Artificial data, Appl. Statist. 21(2) (1972), pp. 160–173.
  * (7) M. T. Landi et al. (2008) Data from: National Center for Biotechnology Information Search database. ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE10072
  * (8) M. W. Mahoney and P. Drineas:  CUR matrix decompositions for improved data analysis, Proc. National Academy of Sciences 106(3) (2009), pp. 697–702.
  * (9) D. Papailiopoulos, A. Kyrillidis and C. Boutsidis:  Provable deterministic leverage score sampling, Proc. 20th ACM SIGKDD Conf. Knowl. Discovery Data Mining (2014), pp. 997–1006.
  * (10) D. C. Sorensen and M. Embree:  A DEIM induced CUR factorization, SIAM J. Sci. Comp., 38 (2016), pp. A1454–A1482.


# Graph-Augmented LLMs for Personalized Health Insights: A Case Study in Sleep
Analysis

Ajan Subramanian1,∗, Zhongqi Yang1, Iman Azimi1, and Amir M. Rahmani1,2 1Dept.
of Computer Science, University of California, Irvine. 2School of Nursing,
University of California, Irvine. (*correspondence email<EMAIL_ADDRESS>
###### Abstract

Health monitoring systems have revolutionized modern healthcare by enabling
the continuous capture of physiological and behavioral data, essential for
preventive measures and early health intervention. While integrating this data
with Large Language Models (LLMs) has shown promise in delivering interactive
health advice, traditional methods like Retrieval-Augmented Generation (RAG)
and fine-tuning often fail to fully utilize the complex, multi-dimensional,
and temporally relevant data from wearable devices. These conventional
approaches typically provide limited actionable and personalized health
insights due to their inadequate capacity to dynamically integrate and
interpret diverse health data streams. In response, this paper introduces a
graph-augmented LLM framework designed to significantly enhance the
personalization and clarity of health insights. Utilizing a hierarchical graph
structure, the framework captures inter and intra-patient relationships,
enriching LLM prompts with dynamic feature importance scores derived from a
Random Forest Model. The effectiveness of this approach is demonstrated
through a sleep analysis case study involving 20 college students during the
COVID-19 lockdown, highlighting the potential of our model to generate
actionable and personalized health insights efficiently. We leverage another
LLM to evaluate the insights for relevance, comprehensiveness, actionability,
and personalization, addressing the critical need for models that process and
interpret complex health data effectively. Our findings show that augmenting
prompts with our framework yields significant improvements in all 4 criteria.
Through our framework, we can elicit well-crafted, more thoughtful responses
tailored to a specific patient.

###### Index Terms:

Personalization, Sleep, Large Language Models (LLMs), Wearable Data, Remote
Monitoring

##  I Introduction

Figure 1: Graph-Based Personalized Prompt Framework with Sleep Analysis as a
Case Study

Wearable health monitoring systems are emerging in modern healthcare, enabling
continuous tracking and analysis of physiological and behavioral data in
everyday settings [1]. These systems provide various health parameters, such
as heart rate, activity levels, and sleep patterns. Recent advancements in
mobile health and wearable sensing technologies have further enhanced the
development of machine learning models to extract relationships between
various objective well-being measures [2, 3, 4]. These technologies facilitate
the objective measurement of sleep patterns and associated physiological
features such as heart rate variability, activity levels, behavior,
environmental influences, etc. and play a crucial role in early detection and
intervention of health conditions.

Recently, health monitoring frameworks powered by Large Language Models (LLMs)
have emerged as a significant advancement, showing promise in providing
personalized and explainable question-answering services [5, 6]. The potential
of those frameworks in healthcare lies in their extensive training on vast
corpora and their ability to be augmented with various types of input through
fine-tuning, Retrieval-Augmented Generation (RAG) frameworks [7], or agent-
based methods. Given their ability to understand and generate responses in
natural language, LLMs enhance patient interactions by providing clear and
understandable responses through these frameworks.

Several pioneering studies have demonstrated the use of LLMs for health
monitoring, particularly when augmented by wearable sensors [8, 9, 10, 11, 12,
6, 13]. Generally, these approaches can be categorized into two main groups.
The first group directly prompts raw signal values from wearable devices to
LLMs to execute tasks. For example, Health-LLM transcribes time series signals
from wearable devices and inputs them into LLMs to enhance forecasting
capabilities [9]. The second category involves an intermediate step to process
data and convert it into natural language text. This step may use statistical
models, machine learning models, or other techniques designed to process data
more efficiently than LLMs [10, 11, 14]. The processed outputs are then
transcribed into text and fed into LLMs using RAG or agent-based approaches.
For example, Chatdiet demonstrates the augmentation of LLMs with causal
inference on wearable data to provide personalized dietary recommendations
[10]. Similarly, [11] employs an agentic framework, OpenCHA, which integrates
external augmentations organized by an orchestrator to improve diabetes
management [12]. These advancements indicate the potential of merging wearable
technology with language models to develop cutting-edge health monitoring
solutions.

However, the existing approaches still fall short in extracting complex
insights from the data collected by wearable and mobile devices. These methods
struggle to provide high-quality personalized responses due to their inability
to fully leverage the multi-dimensional and temporally relevant data [15].
Directly inputting raw signal values from wearable sensors hinders the LLMs’
ability to understand these signals, as LLMs are not designed or trained to
handle numerical data effectively. The second category of methods heavily
depends on intermediate data processing models, but these models are not
optimized for effective integration with LLMs. As a result, they struggle to
capture comprehensive health insights from wearables, particularly temporal
patterns and inter-patient similarities. There is a critical need for enhanced
models that can effectively process and interpret complex personal health data
to offer clear, explainable, and actionable insights.

In this paper, we introduce a graph-augmented LLM framework to generate
personalized health insights. The framework utilizes a hierarchical graph
structure, where each patient is a node and each day’s data are sub-nodes,
connected by cosine similarity to reflect daily and overall pattern
similarities. This setup allows the graph to enhance LLM prompts with feature
importance scores from a Random Forest Model trained on historical and similar
patients’ data. We assess the framework’s effectiveness in a case study
focused on sleep analysis, using data from 20 college students in Southern
California during the COVID-19 lockdown in March 2020. We evaluate the quality
of our framework’s insights by employing another LLM to rate these responses
on four main criteria - relevance, comprehensiveness, actionability, and
personalization.

##  II Method

We propose a graph-augmented LLM framework to deliver personalized health
insights by enhancing user prompts with patient data. It allows users to query
a patient’s wearable data, such as sleep patterns, activity levels, and heart
rate, for particular dates. The process starts with an NLP engine that
extracts essential details like patient ID, metrics of interest, and date from
the prompt. The engine retrieves related demographic and date-specific data
from a dataset. For personalization, we develop an inter and intra-patient
similarity graph to depict hierarchical data relationships. The NLP engine
interacts with the graph to identify the most relevant dates relative to the
query and supports a feature importance model that determines key factors
affecting health metrics based on similar patient data. The resulting
augmented prompt, enriched with these insights, is fed to an LLM to generate
personalized health insights. An overview of the framework architecture is
indicated in Figure 1. In the following, we outline each component of the
proposed framework.

###  II-A NLP Engine

The NLP engine coordinates user queries, extracting key identifiers like
patient ID and date from the prompt. It accesses the dataset to retrieve
relevant demographic and date-specific data, aligning the augmented prompt
with the user’s query. Utilizing a pre-established inter and intra-patient
similarity graph, the engine identifies pertinent temporal and patient
comparison patterns. It also integrates feature importance scores from a model
trained on data from similar patients. This integration enriches the user’s
initial prompt with comprehensive contextual details, formatted for optimal
understanding by an LLM.

###  II-B Dataset

The dataset comprises de-identified patient records, including demographic,
wearable, and textual data, indexed by patient ID and date. The NLP engine
accesses this dataset to retrieve relevant patient-specific information using
a Retrieval-Augmented Generation (RAG) approach [7].

###  II-C Inter and Intra-patient Similarity Graph

The graph integrates diverse physiological, behavioral, and textual data,
utilizing NLP techniques like sentiment analysis to extract sentiments and
themes relevant to desired health outcomes. After careful selection and
standardization, these multimodal data points form a comprehensive,
multidimensional patient profile. We construct an inter and intra-patient
similarity graph using these profiles, employing cosine similarity to quantify
and link relationships based on similarities and differences among days and
patients. This structure is essential for dynamically refining LLM inputs,
thereby enhancing its ability to generate precise health insights by
recognizing patterns across patient data.

###  II-D Feature Importance

We develop an ML model (i.e., Random Forest) to identify the most influential
factors affecting the health metric of interest, using historical data and
information from patients most similar derived from the graph. This model,
crucial for pinpointing key variables, is trained with data extracted from the
graph during each user prompt. Details from the prompt like the patient’s ID
and specified date guide the NLP engine in extracting relevant information
from the graph. The derived feature importance scores are then used to
dynamically enhance the prompt template, improving the accuracy and relevance
of the insights generated.

###  II-E Insight Generation

In the final stage of our pipeline, we employ an LLM to generate personalized
health insights. The prompts are enriched with relevant contextual information
from the patient’s profile and their network of similar patients. The LLM
leverages its advanced natural language capabilities and extensive pre-trained
knowledge to provide nuanced insights into individual health patterns and
well-being. This method combines the insights generated from traditional
machine learning with the reasoning abilities and vast pre-trained knowledge
of advanced NLP to produce comprehensive, personalized health recommendations
tailored to each patient.

##  III Case Study: Sleep Analysis

We evaluate our framework through a sleep analysis case study involving 20
college students collected during the 2020 COVID-19 pandemic. Below, we
outline the dataset in detail and the integrated setup of our framework’s
components.

###  III-A Dataset

We utilize data from a comprehensive remote health monitoring study, capturing
physiological and psychophysiological parameters using the Oura rings [16] and
Samsung Galaxy Active 2 smartwatches. Each patient had data for an average
duration of 7.8 months (SD=3.8, MIN=1.0, MAX=13.4). The ring provided detailed
metrics on sleep stages, duration, and quality, as well as daily activity
levels and cardiovascular health indicators. Additionally, we incorporated
demographic information (age, gender, ethnicity) and daily diary entries
collected through ecological momentary assessments (EMA) [4, 17]. Details of
the data can be found in this article [18].

###  III-B Setup

NLP Engine: Our NLP engine was implemented using Python libraries including
Pandas, Re (regex), and FuzzyWuzzy [19], which processes user prompts into
commands that query the dataset and augment the prompts for deeper analysis.

Graph Construction and Feature Importance: To construct our graph, we use
measurements relevant to sleep such as sleep duration, wakefulness, REM
stages, sleep quality scores, heart rate variability (HRV), and activity
levels. Complementing this, we analyze textual data from daily journal entries
using the ‘transformers’ library, specifically employing Facebook’s BART MNLI
model [20] within a zero-shot classification framework to extract sentiments
and six broad themes spanning academics, personal well-being, and social
interactions. We extract feature importance scores for sleep score based on
information extracted from the graph during query execution. We use a Random
Forest model with 100 trees.

Insight Generation: We use GPT-4 from the OpenAI API [21] to generate
insights. GPT-4’s vast pre-trained knowledge and in-depth reasoning
capabilities allow it to produce well-crafted responses that are easily
accessible to non-experts.

##  IV Results

Table I: Average Scores (out of 10) of LLM Evaluations Across Different Stages

Stage | Relevance | Comprehensiveness | Actionability | Personalization | Uses Graph
---|---|---|---|---|---
Demographic Information | $7.61\pm 1.19$ | $6.80\pm 1.15$ | $6.10\pm 1.76$ | $3.61\pm 1.34$ | No
Current Day Information | $8.65\pm 0.58$ | $7.48\pm 0.68$ | $6.45\pm 0.88$ | $6.08\pm 1.12$ | No
Similar/Dissimilar Days Info | 8.73 $\pm$ 0.50 | 7.51 $\pm$ 0.66 | 6.51 $\pm$ 0.84 | $6.27\pm 1.18$ | Yes
Feature Importance | $8.66\pm 0.64$ | $7.43\pm 0.65$ | $6.47\pm 0.69$ | 6.38 $\pm$ 1.17 | Yes

  * •

Note: Each stage is incremental in that it adds new information to the
previous stage.

In this section, we assess the effectiveness of our proposed framework in
delivering personalized sleep insights given a patient’s profile. Our
objective is to determine the framework’s ability to create a personalized
prompt that would elicit a nuanced, well-crafted response from the LLM. We
compare the performance of our framework by incrementally refining the input
prompts supplied to the LLM. We started with basic demographic information,
then sequentially added current-day data, followed by similar and dissimilar
day information, and finally the feature importance. Each variation was
designed to explore how additional contextual data could enhance the LLM’s
output quality.

To evaluate the output quality of the LLM, we utilized another GPT-4 model, to
perform initial evaluations of the responses generated. We provided the
evaluator LLM with definitions of four criteria—relevance, comprehensiveness,
actionability, and personalization—and asked it to rate each criterion on a
scale from 0 to 10. This process, termed “LLM-guided evaluation” simulates a
peer-review mechanism within a controlled experimental setup, leveraging the
advanced natural language understanding capabilities of LLMs [22]. Using an
LLM as a “reviewer” was instrumental in providing a scaleable and consistent
preliminary assessment tool, enabling us to systematically analyze the quality
of outputs.

We conducted this incremental analysis using 50 diverse prompts across all
patients in our dataset. To minimize any implicit bias from the sequence of
data presentation, we first stored the outputs of each stage and then shuffled
them before the assessment. The evaluation of these outputs was based on the
predefined criteria. We calculated the mean scores and their standard
deviations for each stage. The results, along with LLM-generated ratings for
each stage, are displayed in Table I. Given that both the generation and
evaluation of insights are conducted using the same GPT-4 model, the relative
differences in the scores across stages are more indicative of the framework’s
incremental improvements than their absolute values.

The results shown in Table I indicate a notable improvement in the quality of
LLM outputs as reflected by the aggregated scores for each of the 4 criteria.

  * •

Demographic Information Only: This initial stage provided a baseline for
personalization with scores indicating the least personalized insights.

  * •

Current Day Information: The NLP engine queries the dataset to obtain
information from both this stage and the previous one. The addition of
current-day data improves all metrics. This immediate date-specific context
allows the LLM to produce insights that are significantly more tailored and
actionable because they directly address the patient’s most recent conditions.

  * •

Similar/Dissimilar Days information: The NLP engine queries the similarity
graph to obtain this information. Introducing comparisons between similar and
dissimilar days further enriched the model’s outputs. This stage had the best
scores across most categories showing that the comparative analysis helps the
LLM identify patterns or anomalies over time, providing deeper insights into
the patient’s health fluctuations.

  * •

Feature Importance: The NLP engine extracts this information from the feature
importance component of our framework. The most detailed stage incorporated
the integration of feature importance metrics. This increased personalization.
This stage obtains feature importance from the patient’s history and their
nearest neighbors. The personalization scores are the highest in this stage
highlighting the LLM’s ability to focus on the most impactful health factors
that are specific to the patient.

Our incremental enhancement approach revealed that the depth and utility of
insights from the LLM improved as more detailed and contextual information was
added to the input prompt. Particularly, the introduction of similar and
dissimilar day data allowed the LLM to generate more personalized and
actionable health insights, reflecting a deeper understanding of patient
profiles through a graph-based similarity approach.

##  V Conclusion

This paper proposed a graph-augmented LLM framework that dynamically
integrates complex, multi-dimensional data to enhance the personalization and
accuracy of health insights. Utilizing a hierarchical graph, the framework
effectively captures inter and intra-patient relationships, enriching LLM
prompts for richer, context-aware interactions. The effectiveness of the
framework was validated through a sleep analysis case study involving college
students during the COVID-19 lockdown. The framework’s performance was
assessed using a novel LLM-guided evaluation, which evaluated insights on
relevance, comprehensiveness, actionability, and personalization, showing
significant improvements, especially with the introduction of graph-based
similarities. For future work, integrating Graph Neural Networks (GNNs) could
further enhance the framework’s ability to process and interpret complex data
structures, improving the generation of real-time, personalized health
insights.

## References

  * [1] A. Sano, S. Taylor, A. W. McHill, A. J. Phillips, L. K. Barger, E. Klerman, and R. Picard, “Identifying objective physiological markers and modifiable behaviors for self-reported stress and mental health status using wearable sensors and mobile phones: observational study,” _Journal of medical Internet research_ , vol. 20, no. 6, p. e210, 2018.
  * [2] Z. Yang, Y. Wang, K. S. Yamashita, E. Khatibi, I. Azimi, N. Dutt, J. L. Borelli, and A. M. Rahmani, “Integrating wearable sensor data and self-reported diaries for personalized affect forecasting,” _Smart Health_ , vol. 32, p. 100464, 2024.
  * [3] Z. Yang, I. Azimi, S. Jafarlou, S. Labbaf, J. Borelli, N. Dutt, and A. M. Rahmani, “Loneliness forecasting using multi-modal wearable and mobile sensing in everyday settings,” in _2023 IEEE 19th International Conference on Body Sensor Networks (BSN)_. IEEE, 2023, pp. 1–4.
  * [4] S. Jafarlou, J. Lai, I. Azimi, Z. Mousavi, S. Labbaf, R. C. Jain, N. Dutt, J. L. Borelli, A. Rahmani _et al._ , “Objective prediction of next-day’s affect using multimodal physiological and behavioral data: Algorithm development and validation study,” _JMIR Formative Research_ , vol. 7, no. 1, p. e39425, 2023.
  * [5] S. Ali, T. Dobbs, H. Hutchings, and I. Whitaker, “Using chatgpt to write patient clinic letters. lancet digit health 5, e179–e181,” 2023.
  * [6] H. Yang, J. Li, S. Liu, L. Du, X. Liu, Y. Huang, Q. Shi, and J. Liu, “Exploring the potential of large language models in personalized diabetes treatment strategies,” _medRxiv_ , pp. 2023–06, 2023.
  * [7] P. Lewis, E. Perez, A. Piktus, F. Petroni, V. Karpukhin, N. Goyal, H. Küttler, M. Lewis, W.-t. Yih, T. Rocktäschel _et al._ , “Retrieval-augmented generation for knowledge-intensive nlp tasks,” _Advances in Neural Information Processing Systems_ , vol. 33, pp. 9459–9474, 2020.
  * [8] S. Liu, A. P. Wright, B. L. Patterson, J. P. Wanderer, R. W. Turer, S. D. Nelson, A. B. McCoy, D. F. Sittig, and A. Wright, “Using ai-generated suggestions from chatgpt to optimize clinical decision support,” _Journal of the American Medical Informatics Association_ , vol. 30, no. 7, pp. 1237–1245, 2023.
  * [9] Y. Kim, X. Xu, D. McDuff, C. Breazeal, and H. W. Park, “Health-llm: Large language models for health prediction via wearable sensor data,” _arXiv preprint arXiv:2401.06866_ , 2024.
  * [10] Z. Yang, E. Khatibi, N. Nagesh, M. Abbasian, I. Azimi, R. Jain, and A. M. Rahmani, “Chatdiet: Empowering personalized nutrition-oriented food recommender chatbots through an llm-augmented framework,” _Smart Health_ , vol. 32, p. 100465, 2024.
  * [11] M. Abbasian, Z. Yang, E. Khatibi, P. Zhang, N. Nagesh, I. Azimi, R. Jain, and A. M. Rahmani, “Knowledge-infused llm-powered conversational health agent: A case study for diabetes patients,” _arXiv preprint arXiv:2402.10153_ , 2024.
  * [12] M. Abbasian, I. Azimi, A. M. Rahmani, and R. Jain, “Conversational health agents: A personalized llm-powered agent framework,” _arXiv preprint arXiv:2310.02374_ , 2023.
  * [13] J. Cosentino, A. Belyaeva, X. Liu, N. A. Furlotte, Z. Yang, C. Lee, E. Schenck, Y. Patel, J. Cui, L. D. Schneider, R. Bryant, R. G. Gomes, A. Jiang, R. Lee, Y. Liu, J. Perez, J. K. Rogers, C. Speed, S. Tailor, M. Walker, J. Yu, T. Althoff, C. Heneghan, J. Hernandez, M. Malhotra, L. Stern, Y. Matias, G. S. Corrado, S. Patel, S. Shetty, J. Zhan, S. Prabhakara, D. McDuff, and C. Y. McLean, “Towards a personal health large language model,” 2024.
  * [14] M. A. Merrill, A. Paruchuri, N. Rezaei, G. Kovacs, J. Perez, Y. Liu, E. Schenck, N. Hammerquist, J. Sunshine, S. Tailor, K. Ayush, H.-W. Su, Q. He, C. Y. McLean, M. Malhotra, S. Patel, J. Zhan, T. Althoff, D. McDuff, and X. Liu, “Transforming wearable data into health insights using large language model agents,” 2024.
  * [15] D. Spathis and F. Kawsar, “The first step is the hardest: Pitfalls of representing and tokenizing temporal data for large language models,” _arXiv preprint arXiv:2309.06236_ , 2023.
  * [16] Oura Health Ltd., “Oura ring,” https://ouraring.com/.
  * [17] S. Labbaf, M. Abbasian, I. Azimi, N. Dutt, and A. M. Rahmani, “Zotcare: a flexible, personalizable, and affordable mhealth service provider,” _Frontiers in Digital Health_ , vol. 5, p. 1253087, 2023.
  * [18] S. Labbaf, M. Abbasian, B. Nguyen, M. Lucero, M. S. Ahmed, A. Yunusova, A. Rivera, R. Jain, J. L. Borelli, N. Dutt _et al._ , “Physiological and emotional assessment of college students using wearable and mobile devices during the 2020 covid-19 lockdown: An intensive, longitudinal dataset,” _Data in Brief_ , vol. 54, p. 110228, 2024.
  * [19] S. Cohen, “Fuzzywuzzy: Fuzzy string matching in python,” https://github.com/seatgeek/fuzzywuzzy, 2011.
  * [20] L. Shu, H. Xu, B. Liu, and J. Chen, “Zero-shot aspect-based sentiment analysis,” _arXiv preprint arXiv:2202.01924_ , 2022.
  * [21] J. Achiam, S. Adler, S. Agarwal, L. Ahmad, I. Akkaya, F. L. Aleman, D. Almeida, J. Altenschmidt, S. Altman, S. Anadkat _et al._ , “Gpt-4 technical report,” _arXiv preprint arXiv:2303.08774_ , 2023.
  * [22] Arthur Team, “Llm-guided evaluation: Using llms to evaluate llms,” https://www.arthur.ai/blog/llm-guided-evaluation-using-llms-to-evaluate-llms, 2023.