Recent research has explored clinical monitoring, cardiovascular events, and even clinical lab values from wearables data. As adoption increases, wearables data may become crucial in public health applications like disease monitoring and the design of epidemiological studies.

Perhaps the most common wearable measurement is heart rate, measured as the number of times your heart beats per minute. This number is particularly meaningful when supplied with proper context—being at rest, in the middle of an intense workout, or somewhere in between—your heart rate, and how it changes, can convey meaningful information about your fitness and cardiovascular health.

The idea that moment-to-moment changes in heart rate convey information about health and fitness is driving new research in the exercise physiology community. This research area develops mathematical models of heart rate kinetics that describe how quickly the heart rate adjusts to meet the demand of changing exercise intensity and the effect of fatigue accumulation.

However, existing physiological models were designed to describe heart rate dynamics in a highly controlled laboratory setting — for example, a person riding a stationary bicycle with a well-calibrated power meter and precise cadence measurements. We developed a methodology to blend a physiological model of heart rate kinetics with machine learning components (that is, deep neural networks) to enjoy the benefits of both paradigms — an interpretable model that constrains heart rate predictions to adhere to physiologically plausible first principles, and a flexible and efficient pattern-recognition algorithm that is robust to noisy and uncertain real-world data.

In this research highlight, we describe this recent research project, Modeling Personalized Heart Rate Response to Exercise and Environmental Factors with Wearables Data. We describe the physiological model, our hybrid modeling approach, and our method to efficiently personalize heart rate predictions for an individual user. This personalized approach allows the model to reveal important information about an individual's fitness and cardiovascular health. We also showcase some predictive results, potential use cases, and findings when applying this approach to a large mobile health study — the Apple Heart and Movement Study.

Figure 1: Example heart rate sequences based on synthetic workouts for two different users with different fitness characteristics. Each heart rate sequence is computed using the hybrid ML and physiological model; depicted predictions were synthesized using fitness parameters inferred from real workout data. In this example, User B's heart rate is typically lower and recovers more quickly given the same exercise intensity. For exercise intensity, only elevation changes are depicted (speed is held constant).

Heart Rate Dynamics and Fitness

Some recent research in the sports physiology literature has studied heart rate dynamics under changing exercise conditions. Such approaches translate the physical mechanisms of the cardiopulmonary system into differential equations governed by known relationships between heart rate, oxygen demand, and exercise intensity. Such an expert model is an appealing approach from an interpretability and robustness point of view.

A common approach for modeling changes in heart rate (HR) due to exercise intensity (t → I(t)), is to introduce oxygen demand (D) as an intermediary quantity through a set of coupled ordinary differential equations (ODEs).

Here, the f function (also known as the drive function) translates the instantaneous exercise intensity of I(t) into oxygen demand, D. The top equation matches the current oxygen demand, D, with the instantaneous demand, f(I). Parameter B determines how fast D adapts to f(I). At the same time, the second equation drives these heart rate measurements toward the pace required to deliver the demand D. Parameter A determines how fast the heart can adapt while the terms with HRmin, HRmax, alpha (α), and beta (β) describe how difficult it is to reach the maximal heart rate or to rest down to the minimal heart rate.

Different settings of A, B, α, and β produce different heart rate response predictions to the exact same exercise conditions. Concretely, two different people—a seasoned marathon runner and an occasional exerciser—running together on hilly terrain would have dramatically different heart rate dynamics (and different estimated parameters A, B, α, and β). Through this model, these parameters are a fundamental summary of a person’s fitness.

Study overview
Figure 2: Study overview. We train and validate our method on a subset of the Apple Heart and Movement Study cohort, analyzing thousands of participation and hundreds of thousands of workouts. Our training procedure looks at the first 80% of workouts from each subject, and tests on the most recent 20%. The proposed model is a hybrid: learned representations of participant workout histories are used to inform a physiological model of heart rate response to workout intensity. This differential equation model then outputs heart rate predictions for a new workout.

Hybrid Physiological and Machine Learning Models

Accurately measuring exercise intensity outside of a lab can be a challenge. Instead of a direct measurement, we use data collected from a wearable device — including speed (from GPS), cadence, elevation change, and workout duration — as proxies for exercise intensity. We combine these data streams into a single drive function using a neural network whose parameters are learned from data.

Additionally, when the individual is exercising in a naturalistic setting, environmental factors can influence heart rate. For example, working out in excess heat or humidity can increase the heart’s response to exercise intensity. In a controlled setting, bouts of exercise tend to be short and uniform in length. However, in realistic settings, workouts can range from a few minutes to a few hours. To address these sources of variability, we adjust the equations to account for weather conditions and accumulated fatigue during a workout.

Personalizing Models

Every individual’s body responds uniquely to exercise, and the various parameters like A, B, α, and β, model this response. However, accurately estimating these parameters for each person and workout is not always straightforward.

To address this, we use a learned embedding function that takes an individual’s recent workout history and maps it to an embedding vector, z. All of the previously mentioned physiological models depend on this learned embedding vector. For example, if an individual’s heart rate is slow to equilibrate after an intense bout of exercise, that information is theoretically captured by that person’s z vector.

To learn this embedding function that maps workouts to physiological parameters, we use a convolutional neural network that inputs the person’s most recent workouts, including heart rate, cadence, speed, and elevation change. We train this convolutional neural network by minimizing the heart rate prediction error for fully observed workouts across many subjects in a training set. To test the learned embeddings, z, across a set of held-out subjects, we use the embedding to predict heart rate dynamics in the unseen subjects’ future workout events. In essence, this neural network learns how to quickly fine-tune the ordinary differential equation (ODE) model to a new subject, represented by just a few of that subject’s recent workouts.

Predictions and Results

We deployed our approach on a subset of the Apple Heart and Movement Study, participants, a prospective, single-group, open-label, siteless, pragmatic observational study conducted in collaboration with the American Heart Association and Brigham and Womenʼs Hospital. The purpose of this study was to investigate the relationship between physical activity, mobility, and heart health.

In total, we fit the model to over 270,000 running workouts across 7,465 subjects, and held out future workouts to test the quality of predictions. In order to assess the accuracy of our model, we allow our model and the comparison models to observe three workout events prior to the test workouts used for prediction. For test workouts, we observe only variables that might influence intensity, that is, speed, elevation, cadence, and workout duration. We evaluate two scenarios:

  • One in which the full heart rate sequence from a workout is predicted
  • Another in which the heart rate in only the first two minutes of a workout are observed

We then compare our hybrid modeling approach to three other baselines:

  • A heuristic baseline consisting of the subject’s average workout heart rate
  • A variant of a sequence-to-sequence neural network model (for example, a recurrent neural network) that does not contain any subject-specific encoding (that is, our z vector)
  • Another variant of a sequence-to-sequence neural network model that takes as input the subject-specific encoding

The hybrid ODE model achieves the best performance (lowest mean absolute error and lowest mean absolute percentage error) over both the sequence-to-sequence models and the heuristic baseline.

Notably, the sequence-to-sequence baseline without any subject-specific information performs similarly to the heuristic baseline, illustrating the importance of capturing subject-level information in machine learning models for predicting heart rate. All models perform better after observing the first two minutes of a workout event (often called the warm-up period).

Model
MAE Mean
(BPM) [95% CI]
MAE Med.
(BPM) [IQR]
MAPE Med.
(%) [IQR]
Correlation Med.
[IQR]
Hybrid ODE Model
7.22
[7.21 - 7.24]
6.1
[4.4 - 8.8]
4.2
[3.0 - 6.1]
.88
[.73 - .94]
Seq-to-seq
7.52
[7.51 - 7.54]
6.5
[4.7 - 9.1]
4.5
[3.2 - 6.4]
.85
[.68 - .93]
Seq-to-seq (no z)
12.57
[12.54 - 12.59]
10.8
[7.1 - 16.3]
7.3
[3.8 - 11.0]
.81
[.62 - .91]
Subject Ave HR (BPM)
12.21
[12.19 - 12.23]
10.8
[7.9 - 15.0]
7.5
[5.4 - 10.6]
n/a
Hybrid ODE Model (2+ min)
6.90
[6.89 - 6.92]
5.8
[4.0 - 8.5]
6.90
[2.6 - 5.8]
.88
[.73 - .94]
Seq-to-seq (2+ min)
7.12
[7.11 - 7.14]
6.0
[4.2 - 8.7]
7.12
[2.8 - 6.0]
.85
[.68 - .93]
Seq-to-seq (no z) (2+ min)
12.39
[12.36 - 12.42]
10.5
[6.7 - 16.3]
12.39
[4.4 - 10.9]
.81
[.62 - .91]

We additionally evaluate two other metrics beyond heart rate measurements for our model to predict:

  • Heart rate zone
  • Estimated maximum rate of oxygen uptake (VO2 max)

For heart rate zone predictions, we take zone intervals as a percentage of each subject’s estimated maximal heart rate (HRmax): 0, 50, 60, 70, 80, 90, and 100, as shared by the Center For Disease Control and Prevention. Beyond absolute heart rate measurements, heart rate zones help guide cardiovascular training, as the elicited adaptation varies by zone. Our model can predict the zone with an accuracy of about 67 percent, compared to a laboratory-developed baseline of the most prevalent zone, which would predict the correct zone about 38 percent of the time. In predicting estimated VO2max, we find our model’s subject-specific embedding vector improves upon the mean-squared error of using only demographic information by nearly 47 percent. The improvement indicates that our model captures information relevant to cardiorespiratory health in the subject-specific encoding vector.

Additionally, since we gather data from real-life exercise settings, it is likely that weather significantly impacts heart rate response. We extended the physiological ODE structure to incorporate a function of both temperature and humidity measurements for outdoor workouts. As temperature and humidity increase, we observe a concordant increase in heart rate of about 4.5 to 9 beats per minute as the temperature reaches 100° F (approximately 38° C).

Conclusion

In this work, we’ve shown the power of a hybrid physiological–machine learning model that we developed to accurately predict heart rate during workouts. By incorporating recent developments in machine learning methodology, we were able to extend exercise physiology models that were developed for and tested in in-lab settings to naturalistic outdoor workouts that capture more realistic behavior. Furthermore, this hybrid modeling approach benefits from making accurate predictions compared to machine learning-only models. Additionally, the hybrid modeling approach relies heavily on physiology to link subject-specific encodings with cardiorespiratory fitness measures like VO2max. Our results further emphasize the need for such approaches to incorporate subject-specific information, as the sequence-to-sequence machine learning baseline depends heavily on this information to accurately predict heart rate.

Exercise is one of the most powerful tools for improving health and wellbeing. Nevertheless, tracking and assessing progress on the individual’s fitness journey remains challenging, as adaptations occur on multiple time scales and different metabolic systems. It can be helpful to understand the individual’s acute state (for example, their level of restfulness and fatigue) as well as to incorporate the effect of weather (such as temperature and humidity) when planning training. Our hybrid machine learning and expert models help support more efficient workouts for a personalized and targeted goal — whether mental, physical, or emotional wellbeing — and help individuals plan and assess their fitness journey.

Acknowledgments

Many people contributed to this work, including Achille Nazaret, Andrew C. Miller, Calum MacRae, Gregory Darnell, Guillermo Sapiro, Jen Block, Sana Tonekaboni, and Shirley You Ren.

Apple Resources

Apple GitHub. 2023. “Modeling Personalized Heart Rate Response to Exercise and Environmental Factors with Wearables Data.” link.

Apple Support. 2019. “Your Heart Rate. What It Means, and Where on Apple Watch You’ll Find It.” link.

Brigham and Women’s Hospital. 2019. “Apple Heart and Movement Study.” link.

External References

CDC. “Target Heart Rate and Estimated Maximum Heart Rate | Physical Activity | CDC.” 2019. link.

Dunn, Jessilyn, Lukasz Kidzinski, Ryan Runge, Daniel Witt, Jennifer L. Hicks, Sophia Miryam Schüssler-Fiorenza Rose, Xiao Li, et al. 2021. “Wearable Sensors Enable Personalized Predictions of Clinical Laboratory Measurements,” June. link.

Tang, Matilda Swee Sun, Katherine Moore, Andrew McGavigan, Robyn A Clark, and Anand N Ganesan. 2020. “Effectiveness of Wearable Trackers on Physical Activity in Healthy Adults: Systematic Review and Meta-Analysis of Randomized Controlled Trials,” July. link.

Ballinger, Brandon M, Johnson Hsieh, Avesh Singh, Nimit Sohoni, Jack Wang, Geoffrey H Tison, Gregory M Marcus, et al. 2018. “DeepHeart: Semi-Supervised Sequence Learning for Cardiovascular Risk Prediction,” February. link.

Nemati, Shamim, Mohammad M. Ghassemi, Vaidehi Ambai, Nino Isakadze, Oleksiy Levantsevych, Amit Shah, and Gari D. Clifford. 2016. “Monitoring and Detecting Atrial Fibrillation Using Wearable Technology,” August. link.

Suzuki, Takuji, Ken-ichi Kameyama, and Toshiyo Tamura. 2009. “Development of the Irregular Pulse Detection Method in Daily Life Using Wearable Photoplethysmographic Sensor.” link.

Ates, H. Ceren, Ali K. Yetisen, Firat Güder, and Can Dincer. 2021. “Wearable Devices for the Detection of COVID-19,” January. link.

Radin, Jennifer M, Nathan E Wineinger, Eric J Topol, and Steven R Steinhubl. 2020. “Harnessing Wearable Device Data to Improve State-Level Real-Time Surveillance of Influenza-like Illness in the USA: A Population-Based Study,” January. link.

Golbus, Jessica R., Nicole A. Pescatore, Brahmajee K. Nallamothu, Nirav Shah, and Sachin Kheterpal. 2021. “Wearable Device Signals and Home Blood Pressure Data across Age, Sex, Race, Ethnicity, and Clinical Phenotypes in the Michigan Predictive Activity & Clinical Trajectories in Health (MIPACT) Study: A Prospective, Community-Based Observational Study,” November. link.

Achille Nazaret, Sana Tonekaboni, Gregory Darnell, Shirley You Ren, Guillermo Sapiro, and Andrew P Miller. 2023. “Modeling Personalized Heart Rate Response to Exercise and Environmental Factors with Wearables Data.” Npj Digital Medicine 6 (1). link.

Related readings and updates.

Apple Workshop on Machine Learning for Health 2023

Earlier this year, Apple hosted the Workshop on Machine Learning for Health. This two-day hybrid event brought together Apple and the academic research community and clinicians to discuss state-of-the-art machine learning (ML) research in health.

See event details

Modeling Heart Rate Response to Exercise with Wearable Data

This paper was accepted at the workshop "Learning from Time Series for Health" at NeurIPS 2022. Heart rate (HR) dynamics in response to workout intensity and duration measure key aspects of an individual’s fitness and cardiorespiratory health. Models of exercise physiology have been used to characterize cardiorespiratory fitness in well-controlled laboratory settings, but face additional challenges when applied to wearables in noisy, real-world…
See paper details