This is an open-access article distributed under the terms of the Creative Commons Attribution License (https://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work, first published in JMIR Diabetes, is properly cited. The complete bibliographic information, a link to the original publication on https://diabetes.jmir.org/, as well as this copyright and license information must be included.
Diabetes affects millions of people worldwide and is steadily increasing. A serious condition associated with diabetes is low glucose levels (hypoglycemia). Monitoring blood glucose is usually performed by invasive methods or intrusive devices, and these devices are currently not available to all patients with diabetes. Hand tremor is a significant symptom of hypoglycemia, as nerves and muscles are powered by blood sugar. However, to our knowledge, no validated tools or algorithms exist to monitor and detect hypoglycemic events via hand tremors.
In this paper, we propose a noninvasive method to detect hypoglycemic events based on hand tremors using accelerometer data.
We analyzed triaxial accelerometer data from a smart watch recorded from 33 patients with type 1 diabetes for 1 month. Time and frequency domain features were extracted from acceleration signals to explore different machine learning models to classify and differentiate between hypoglycemic and nonhypoglycemic states.
The mean duration of the hypoglycemic state was 27.31 (SD 5.15) minutes per day for each patient. On average, patients had 1.06 (SD 0.77) hypoglycemic events per day. The ensemble learning model based on random forest, support vector machines, and k-nearest neighbors had the best performance, with a precision of 81.5% and a recall of 78.6%. The results were validated using continuous glucose monitor readings as ground truth.
Our results indicate that the proposed approach can be a potential tool to detect hypoglycemia and can serve as a proactive, nonintrusive alert mechanism for hypoglycemic events.
Diabetes is a chronic condition that is estimated to affect over 9.3% of the global population as of 2019 [
Low blood glucose (BG), also known as hypoglycemia, is a serious condition that affects patients with diabetes when their BG level falls below 70 mg/dL [
The most prevalent method of monitoring BG has been via BG meters, which require manually pricking the finger to get a reading. However, the main limitation of these meters is that the measurement is periodic and manual. Continuous glucose monitors (CGMs) were commercialized at the beginning of the 21st century [
“Tremor” or “trembling” has been reported to be a common sign of hypoglycemic events among patients with diabetes [
Monitoring tremors may provide a cost-effective and nonintrusive method to detect the onset of hypoglycemic events. Accelerometer sensors are validated devices to measure motion and have been used in various applications such as assessing physical activity [
Machine learning has shown promise for prognosis in medicine [
With these challenges in mind, the objective of this research is to develop machine learning algorithms to detect hypoglycemia through hand tremors using acceleration data from a 1-month home study on adults with T1DM. We expect this research to enable real-time monitoring of hypoglycemia through noninvasive and nonintrusive wearable technologies with a built-in accelerometer sensor. The remainder of this paper describes our methods used to collect data, discusses the data processing steps, presents the results of developed algorithms, and concludes with a discussion of our findings and recommendations for future work.
A home study was designed to collect continuous accelerometer data from participants with T1DM. Accelerometer data were collected using Apple Watch Series 5 (Apple Inc) with a sampling frequency of 64 Hz. We used a mobile app called TremorApp to record, archive, and transfer the accelerometer data. TremorApp is an app our team customized in the lab to run continuously in the background of the watch. It allows participants to make a single tap on the Apple watch whenever they feel they have low blood sugar, and it is logged automatically. In addition, the app is connected to participants’ iPhones, where they can track the number of hypoglycemic events they have reported, as well as their HR and acceleration. The participants then transferred their data from the phone to our cloud folder upon completion of the study.
Participants who had an Apple Watch Series 5 were allowed to use their own watch. We monitored the data for 1 week, and if there were any issues with running the app or data collection, then we mailed them our own Apple Watch Series 5 for the purpose of this study under the agreement that they would return it upon completion.
The inclusion criterion was patients with T1DM who regularly used CGMs. To be consistent, only patients who were using a Dexcom CGM (G5 and G6; Dexcom Inc) were enrolled in the study. Dexcom uses a sensor wire inserted underneath a person’s skin to measure glucose readings in interstitial fluid throughout the day and night, with a sampling frequency of 5 minutes [
The participants were instructed to wear the smart watch continuously for 1 month and report the instances of tremors. Every week, participants would upload their accelerometer data file, subjective low blood sugar logs, HR data file, and CGM logs over their phones to a secure server after being trained on how to do so over the internet with the help of a researcher from the team (author KZ). In this study, we only used acceleration data and CGM logs for the classification problem. Self-reported hypoglycemia and heart data were not used in this study.
Adults (>18 years old) diagnosed with T1DM who use a CGM device were invited to participate in this study through the university’s campus bulk mail. A total of 45 participants started the study, among whom 7 dropped out due to nonconformance or technical issues with the phone, Apple Watch, or CGM. In addition, 5 patients’ devices did not correctly record accelerometer data. The data collected from 33 patients, including 21 (64%) females and 12 (36.4%) males, aged between 18 and 56 (mean 25.35) years were included in this study. Out of the 33 participants, 3 (9 %) identified as having 2 or more races, and the remaining (n=30, 91%) all identified as White. Additionally, 6 (18%) participants identified as being of Hispanic/Latino heritage. On average, patients wore CGM devices 95.44% (SD 3.27%) of the time per day. Each patient was expected to wear their watch the whole day. However, it was worn 39.93% (SD 29.57%) each day. Therefore, on average, 31.26% (SD 16.52%) of overlapped accelerometer and CGM data equal to 450.14 (SD 237.89) minutes were available per day for each patient. These overlapped data were used in this study. Note that data recorded during sleep were also included and treated the same way as nonsleep data. Additionally, there was no particular period in the day where data were unavailable for all patients. In other words, in every hour of a 24-hour day, there was at least 1 patient with available data.
The study was approved by the institutional review board of Texas A&M University (IRB2019-0261F) and complied with the American Psychological Association Code of Ethics. All participants provided informed consent.
All data preprocessing was completed using Python version 3.6.9 software (Python Software Foundation). Acceleration components were filtered using a second-order Butterworth low-pass filter (cutoff frequency was set to 30 Hz). The magnitude of the 3D acceleration was calculated as the square root of acceleration components in the x, y, and z directions. To provide sufficient patterns of data for hand tremor detection, accelerometer data were divided into 3-second sliding windows with 50% overlap [
Once signals were preprocessed, a total of 86 features (42 for the time domain and 44 for the frequency domain) were extracted from the windowed acceleration data (x, y, z, and the magnitude) [
The fast Fourier transform was used for the frequency domain analysis. Hypoglycemia is characterized by hand tremors with a frequency range between 4 and 14 Hz [
Summary of features included in the machine learning models.
Category and features | Abbreviation | |
|
||
|
Mean | M |
|
Standard deviation | SD |
|
Variance | V |
|
Maximum | Max |
|
Minimum | Min |
|
Range | R |
|
Number of peaks | NOP |
|
Skewness | SK |
|
Kurtosis | KS |
|
Correlation coefficient | CORR |
|
||
|
Mean | M |
|
Maximum | Max |
|
Standard deviation | SD |
|
Number of peaks | NOP |
|
Average band power | ABP |
|
Normalized average band power | NABP |
|
Frequency of maximum power spectral density | Fmax |
|
||
|
Mean | M |
|
Maximum | Max |
|
Standard deviation | SD |
|
Average band power | ABP |
aHTFR: hand tremor frequency range.
Many classification approaches have been used to classify tremors versus normal states, mainly for Parkinson disease or essential tremor disorder [
Based on the promise of models used in the tremor literature, we used 3 machine learning models—random forest, SVM, and KNN—to classify hand tremors (hypoglycemic state) from nonhypoglycemic states in patients with hypoglycemia. Randomized searches were performed to tune the models. Random forest is a flexible supervised machine learning algorithm comprising uncorrelated decision trees, which are combined to create more accurate predictions and reduce variance [
The 3 machine learning models were trained on the acceleration features. We also used ensemble learning for the hypoglycemia classification. Ensemble methods are techniques that create multiple models and then merge them to improve classification performance [
We performed sequential classification, which is a predictive modeling approach where a consecutive sequence of inputs over time is considered, and the task is to predict the hypoglycemia category for the aggregated sequence as a whole [
All analyses were implemented in Python software (Python Software Foundation). As shown in
Overview of the analysis approach. ACC: acceleration. ML: machine learning.
To evaluate the classification models, we used 2 cross-validation (CV) strategies, 10-fold CV and leave-one-subject-out (LOSO) CV [
Where
The mean duration of the hypoglycemic state was 27.31 (SD 25.15) minutes per day for each patient. On average, patients had 1.06 (SD 0.77) hypoglycemic events per day. We used acceleration features in time and frequency domains to classify hypoglycemic versus nonhypoglycemic states through hand tremors. The mean PSD for the frequencies between 4 and 14 Hz 4 for the hypoglycemic windows was
However, for the nonhypoglycemic windows, it was
Exemplar acceleration magnitude and the corresponding power spectral density (PSD) for hypoglycemic and nonhypoglycemic states during resting position. ACC: acceleration; HG: hypoglycemic; non-HG: nonhypoglycemic.
Exemplar acceleration magnitude and the corresponding power spectral density (PSD) for hypoglycemic and nonhypoglycemic states during active position. ACC: acceleration; HG: hypoglycemic; non-HG: nonhypoglycemic.
It was observed that in the resting position, the amplitude of the acceleration in the time domain and the amplitude of the frequencies in the tremor range (4-14 Hz) were higher for the hypoglycemic state compared to the nonhypoglycemic state. Additionally, in both resting and active positions, higher variations were observed in the PSD of frequencies between 4 and 14 Hz for the hypoglycemic states than nonhypoglycemic states. The average SD of PSD in frequencies between 4 and 14 Hz for the hypoglycemic windows was
However, for the nonhypoglycemic windows, it was
Most of the higher amplitude frequencies in hypoglycemic states were in the 4 to 14 Hz range, with some patient-specific variations.
To better understand which features are more relevant, we computed the mean decrease in impurity (MDI) based on Gini impurity from the random forest algorithm [
Feature importance using mean decrease in impurity (MDI) from the random forest structure, along with their intertree variability represented by the error bars. ABP: average band power; CORR: correlation between axis; Fmax: frequency of maximum power spectral density; HTFR: hand tremor frequency range; KS: kurtosis; M: mean; Max: maximum; Min: minimum; NABP: normalized average band power; NOP: number of peaks; SK: skewness; R: range; V: velocity.
Receiver operating characteristic (ROC) curve and corresponding area under the curve (AUC) values for the 3 algorithms evaluated in this study. KNN: k-nearest neighbor; SVM: support vector machine.
Performance of classification models using 10-fold cross-validation (CV) and leave-one-subject-out (LOSO) CV.
Model | AUROCa | Specificity (%) | Precision (%) | Recall (%) | Accuracy (%) | |||||||||||||
|
LOSOb | 10-fold | LOSO | 10-fold | LOSO | 10-fold | LOSO | 10-fold | LOSO | 10-fold | LOSO | 10-fold |
|
|||||
KNNc | 0.88 | 0.88 | 83.15 | 80.78 | 82.03 | 79.92 | 76.95 | 76.97 | 79.41 | 78.40 | 79.93 | 78.83 |
|
|||||
SVMd | 0.87 | 0.87 | 81.15 | 82.93 | 81.48 | 79.98 | 75.94 | 77.72 | 78.28 | 78.83 | 78.46 | 80.24 |
|
|||||
Random forest | 0.88 | 0.90 | 80.51 | 84.48 | 80.37 | 82.67 | 77.45 | 77.96 | 78.88 | 80.24 | 78.95 | 81.09 |
|
|||||
Ensemble learning | N/Ae | N/A | 81.51 | 84.55 | 80.74 | 81.53 | 78.82 | 78.59 | 79.76 | 80.03 | 80.14 | 81.46 |
|
aAUROC: area under the receiver operating characteristic curve.
bLOSO: leave one subject out.
cKNN: k-nearest neighbor.
dSVM: support vector machine.
eN/A: not available.
The primary purpose of this study was to use a wrist-worn accelerometer sensor to detect hand tremors associated with hypoglycemia in patients with T1DM. We used the acceleration and CGM data collected from 33 patients with T1DM. Several machine learning algorithms were employed to develop the detection system. The ensemble learning model achieved the highest accuracy of 81.46%, with 81.5% precision and 78.6% recall for the hypoglycemic class.
Collectively, the results provide support for the use and further development of ensemble techniques (such as random forest), KNN, SVM, or a combination of these models for hypoglycemia hand tremor detection. These results align with previous explorations of tremor detection [
The acceleration-based detection system in this study is comparable to the recent research on hypoglycemic detection using other noninvasive sensor-based data such as HR, HR variability, ECG, and temperature. Maritsch et al [
The method documented in this paper represents our initial computational work for detecting hand tremors associated with hypoglycemia using acceleration data in a naturalistic setting. To our knowledge, this is the first paper documenting the application of machine learning for the detection of the onsets of hypoglycemia using hand tremors. We used a longitudinal data set collected within 1 month, comprising 21 females (64%) and 12 males (36%), with an average of 24.04 and 26.26 minutes hypoglycemic per day, respectively. The obtained results suggest that wrist-worn accelerometers may provide the necessary sensory information to detect the presence of hand tremors associated with hypoglycemia. Given the increased availability, affordability, discreetness, accuracy, and nonintrusiveness of smart watch–based accelerometer sensors, these results show promise as an alternative to CGM for the early detection of hypoglycemic events, and they may have life-saving implications.
However, this study is not without limitations. First, the analysis presented here is based on a limited sample. In addition to the 5 patients (13%) whose devices did not adequately record their accelerometer data, 3 (9%) patients did not have any low blood sugar readings recorded on their CGM. This might be due to some CGM users setting higher thresholds for hypoglycemic alerts (eg, 75-80 mg/dL), perceiving hypoglycemic events early, or better managing hypoglycemic events. In addition, participant age could also be an important limitation since most of the participants in this study were college students with an average age of 24.56 (SD 9.67) years.
HTFR features were extracted from the PSD between 4 and 14 Hz frequencies to distinguish hypoglycemic states from nonhypoglycemic states. Although HTFR features helped improve the classification performance, there were several windows labeled hypoglycemic without showing noticeable power density in the 4 to 14 Hz frequencies and several windows labeled nonhypoglycemic with high power density in the 4 to 14 Hz frequencies. Different reasons can cause these to happen during accelerometer or CGM readings, such as motion artifacts or nonhypoglycemic tremors. This study collected data during activities of daily living. Motion artifacts are unavoidable when an acceleration sensor is used in dynamic conditions. Sensor measurements are usually contaminated by motion artifacts due to hand movement, wearable tightness level [
People who experience hypoglycemic events are likely to experience repeated episodes of hypoglycemia. Over time, repeated episodes of hypoglycemia can cause hypoglycemia unawareness. The brain and body no longer produce symptoms that warn of low blood sugar, such as tremors or irregular heartbeat [
In this study, we do not distinguish between the different causes of low glucose values and hand tremors. For example, high-intensity physical activities may cause blood sugar to drop below this threshold in some instances [
Finally, the objective of this research was not to evaluate an intervention. As a result, participants were not instructed to undertake any particular action to manage hypoglycemia (such as eating or drinking certain foods) beyond their normal habits. However, the findings documented in this paper can inform the design of nonintrusive accelerometer-based hypoglycemia detection and monitoring tools and systems.
Hypoglycemia is a prevalent disease that affects millions of people worldwide. While tools and technologies exist to help patients with hypoglycemia monitor their BG, they are either invasive, requiring finger pricking, or intrusive and expensive. The proposed work utilized a combination of nonintrusive and noninvasive sensing and machine learning methods to develop detection algorithms for hypoglycemic events via hand tremors. This paper documents the potential of linear accelerator data to provide significant utility for classification models that detect hypoglycemic hand tremors and distinguish between hypoglycemic and nonhypoglycemic states. Our results, while preliminary, suggest that wearable monitoring technology for the continuous detection and remote monitoring of hypoglycemic events through hand tremors is an achievable goal in the near future.
average band power
area under the curve
area under the receiver operating characteristic curve
blood glucose
continuous glucose monitor
correlation coefficient
cross-validation
electrocardiogram
frequency of maximum power spectral density
heart rate
hand tremor frequency range
k-nearest neighbor
leave one subject out
mean decrease in impurity
normalized average band power
number of peaks
power spectral density
radial basis function
receiver operating characteristic
support vector machine
type 1 diabetes mellitus
This publication was made possible by the National Priorities Research Program (NPRP) award (10-1231-160071) from the Qatar National Research Fund (a member of the Qatar Foundation). The statements made herein are solely the responsibility of the authors.
None declared.