Machine-Learning-Based Diabetes Prediction Using Multisensor Data

Diabetes is one such chronic disease that, if undetected, can result in several adverse symptoms or diseases. It requires continuous and active monitoring, for example, by using various smartphone sensors, wearable/smart watches, etc. These devices are minimally invasive in nature and can also track various physiological signals, which are important for the prediction of diabetes. Machine-learning algorithms and artificial intelligence are some of the most important tools used for the prediction/detection of diabetes using different types of physiological signals. In this study, we have focused on using multiple sensors such as glucose, electrocardiogram (ECG), accelerometer (ACC), and breathing sensors for classifying patients with diabetes disease. We analyzed whether a single sensor or multiple sensors can predict diabetes well. We identified various time-domain and interval-based features that are used for predicting diabetes and also the optimal window size for the feature calculation. We found that a multisensor combination using glucose, ECG, and ACC sensors gives the highest prediction accuracy of 98.2% with the extreme gradient boosting (XGBoost) algorithm. Moreover, multisensor prediction shows nearly 4%–5% increase in the diabetes prediction rates as compared to single sensors. We observed that breathing-sensor-related data have very little influence on the prediction of diabetes. We also used the score-fit-times curve as one of the metrics for the evaluation of models. From the performance curves, we observed that three-sensor combinations using glucose, ECG, and ACC converge faster as compared to a four-sensor combination while achieving with same accuracy.


I. INTRODUCTION
D IABETES is considered a chronic disorder or chronic disease that is identified by abnormal blood glucose levels caused by ineffective utilization or insufficient production of insulin [1].This is considered chronic in nature because this disease requires active monitoring and, if not monitored, this can even develop into more complex diseases [2].Similarly, uncontrolled diabetes results in long-term damage to several parts of the body such as kidneys, eyes, heart, Manuscript received 19 July 2023; revised 5 September 2023; accepted 12 September 2023.Date of publication 2 October 2023; date of current version 14 November 2023.This work was supported in part by the Academy of Finland "Secure and Privacy Preserving Healthcare in the Residential Environment with Multimodal Distributed Data and Decentralized AI" and "The Intelligent Society Platform (INSO)" under Grant 345684; in part by "INSO" is an Academy-of-Finland-Funded Profiling Action, Operating in Tampere University; and in part by AISOLA and SPHERE-DNA NURMI Project Team.The associate editor coordinating the review of this article and approving it for publication was Dr. Priyadip Ray.(Corresponding author: Aditi Site.) The authors are with the Electrical Engineering Unit, Tampere University, 33720 Tampere, Finland (e-mail: aditi.site@tuni.fi;jari.nurmi@tuni.fi;elena-simona.lohan@tuni.fi).
Digital Object Identifier 10.1109/JSEN.2023.3319360blood vessels, etc., and it can even cause stroke, hypertension, and cardiovascular disease [3].Diabetes is often classified into type 1 diabetes mellitus, type 2 diabetes mellitus, and gestational diabetes [4].Type 2 diabetes mellitus requires monitoring of the daily activity of the person as this type of disease occurs mostly because of the changes in lifestyle/activity, whereas type 1 diabetes mellitus is insulin-dependent diabetes and occurs mainly because of the variations in the insulin levels.Type 2 diabetes is often linked with low physical activity levels and an increasing age.So, there is a need for continuous monitoring to avoid the complications due to diabetes.
With the advent of smart-computing sensors, such as smartwatches, smartphones, and other wearable, along with emerging healthcare solutions, it has become comparatively easier to monitor continuously and remotely the health of patients either in-home or hospital environments.Embedded sensors in these devices are capable of monitoring various physiological signals, such as electrocardiogram (ECG) or accelerometer (ACC) data.Results in [2] have shown that there are several sensors that have been used to monitor various physiological signals such as ACCs, gyroscopes, magnetometers, ECG, electroencephalogram (EEG), glucometers, etc. Hyperglycemia or increased glucose levels can affect various components of ECG such as QT intervals [5].So, ECG sensors are considered one of the key sensors used for hyperglycemia detection and continuous glucose monitoring.Similarly, studies have also used ACC sensors [6] for tracking the daily activity of a person as daily activity is one of the important biomarkers for continuous monitoring of diabetes.However, very few studies have used breath-related data for the monitoring of diabetes.Studies in [7] have used some biomarkers that are related to blood glucose levels but they are detected using various chemical sensors.Sha et al. [8] have used breath analysis methods to detect diabetic ketoacidosis.
To improve the quality of care, various researches has been conducted including the analysis of physiological signals, obtained from various sensors, using artificial intelligence and machine learning.Systematic literature study in [2] has identified various machine learning algorithms that have been used so far for monitoring various types of chronic diseases such as diabetes, arrhythmia, Parkinson's, etc. Various types of supervised and unsupervised algorithms have been used in these studies such as logistic regression (Logreg), decision trees, support vector machines (SVCs), k-nearest neighbor, ensemble algorithms such as extreme gradient boosting (XGBoost), adaptive boosting (AdaBoost), gradient boosting, neural network algorithms such as multilayer perceptrons (MLPs), deep neural network, long short-term memory network, convolutional neural network for image analysis.Table I shows various studies that have predicted diabetes using machine learning methods, sensor/datasets used by such studies, algorithms used for diabetes prediction, and algorithm's performance.
Previous studies that have used machine learning algorithms for diabetes detection and prediction have either used datasets such as PIMA, 1 or they have used single sensors such as either glucose values, ECG sensors, or ACCs.However, very limited studies have used multiple sensors for predicting diabetes diseases as mentioned in Table I [5], [10], [11].One of the novelty in this study is its primary focus on using data from multiple sensors for diabetes prediction.The availability of data from multiple sensors helps to identify several patterns, correlations, and relationships between these sensors.For instance, ECG, and ACC sensor data can affect the glucose level in patients so the impact of variations in these signals on glucose levels can also affect the prediction rates of diabetes disease.Moreover, long-term diabetes can result in other cardiovascular diseases, breathing problems, or reduced activity levels so using multisensor data it is also possible to monitor the chances of such diseases.Additional novelty in this study comes from obtaining the optimal window size for individual sensor data for diabetes prediction and also identifying what sensors and their combinations can result in the best accuracy for predicting diabetes diseases.

II. RESEARCH QUESTIONS
The objective of this research is to predict diabetes using data from different types of wearable/sensors such as glucose, 1 https://www.kaggle.com/datasets/uciml/pima-indians-diabetes-databaseIII.DATASET DESCRIPTION This section describes the dataset used for the prediction of diabetes using the data from multiple sensors.The D1NAMO dataset used in this article is described in [13].This dataset consists of four types of sensor data such as ECG sensor data, breathing sensor data, ACC signals, and glucose measurements.The dataset also consists of food-annotated pictures but in the scope of this study, the data from four sensors are only considered.This multimodal dataset is acquired on patients in non-clinical conditions using the Zephyr BioHarness three wearable devices.
This multimodal dataset includes data from 29 patients, out of which 20 are healthy people and 9 are diabetes patients.The dataset consists of continuous values for ECG, ACC, and breathing signals for four days for both healthy and diabetic groups.Glucose measurements for diabetic patients were recorded at an interval ranging from 1 to 5 min and for non-diabetic patients data was recorded at irregular intervals (as glucose levels did not vary much).The frequency of recording the ECG, ACC, and breathing waveform was 250, 100, and 25 Hz, respectively.This dataset also included other measurements such as heart rate (HR), breath rate, skin temperature, and HR variability (HRV) but in this study, we considered the waveform data from four sensors and glucose measurements data.
Several datasets have been released for the detection and prediction of diabetes such as MIMIC II [14] dataset available in PhysioNet2 platform, datasets from University of California Irvine (UCI) machine learning repositories [15].Moreover, other datasets that also contained data from multiple sensors included the MHEALTH [16] dataset, and diabetes dataset from continuous monitoring and manual monitoring.However, the dataset described in [13] and used in this study includes the data from four different types of sensors to explore the direct and indirect consequences of the ECG signals, activity data, and breathing signals on the glycemic events of the patients.

IV. METHODOLOGY
This section describes the methodology and implementation framework used for the multimodal data-based diabetes prediction.This section also describes different types of time-domain, and frequency-domain features being obtained from the raw data or raw signals.It also discusses various machine learning algorithms and evaluation criteria used for diabetes prediction.This section is organized into four sections namely implementation framework, feature engineering, machine learning algorithms used, and evaluation criteria, explained in detail.

A. Implementation Framework
The implementation framework of single and multisensorbased diabetes prediction is shown in Fig. 1.The implementation of this concept includes two main components.One is a machine learning engine and another is a multisensor-based prediction engine.A machine learning engine is used to obtain the algorithm that performs best when single sensors are considered for diabetes prediction.The second component, a multisensor prediction engine is used to obtain the diabetes prediction results when multiple sensor combinations such as two-sensor combinations, three-sensor combinations, and four-sensor combinations are considered.
As shown in Fig. 1, the data from different sensors are given to a machine learning engine where the individual data is processed and analyzed separately.The machine learning engine includes a feature engineering stage where raw data is divided into window sizes.In this study, we have explored five different window sizes 15-s, 30-s, 1-min, 2-min, and 5-min window sizes.Different time-domain and interval-based features were calculated for the ECG, ACC, and breathing signals in the above-mentioned window periods.A transformed dataset with a wide variety of features was given to the set of supervised machine-learning algorithms.The output of the machine learning engine is the algorithm that performs best for the individual sensor.This output is based on the accuracy of the algorithm on sensor data and the time complexity.This output is given to the second engine, which is a multisensor prediction engine.
Multisensor prediction engine combines the data from different sensors and evaluates the diabetes prediction accuracy when two sensors, three sensors, and all four sensors are considered.In this scenario, the transformed features from different sensors are combined and given to the algorithms that performed best in the previous engine (machine learning engine) for the different sensors.For example, if the data from glucose and ECG sensor is considered, then the combined data from glucose and ECG is given to the two algorithms, one which performed best for glucose and the other which performed best for ECG, and the performance of algorithms on both the algorithms are evaluated.In a similar way, the combination of three sensor data and four sensor data are also evaluated.Finally, the results of different sensor combinations along with single sensor results are compared to determine which approach among single sensor or multisensor is better for diabetes prediction.
Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.

B. Feature Engineering
Feature engineering is a pre-processing step that transforms raw data into features, these features are then given to machine learning models.Feature engineering helps in creating a set of useful variables for predicting the outcome.It involves feature creation, feature transformation, feature selection, etc.In this study, we have applied a feature engineering process to the raw time-series data from ECG, ACC, and breathing sensors.Glucose recordings are used as it is for the prediction tasks.We extracted various time-domain and interval-based features from the sensor recordings.
1) Glucose Data: Differences in measurement intervals of glucose data for diabetic patients and non-diabetic patients resulted in unbalanced data for glucose recordings.So we applied two methods, namely random under-sampling and averaging glucose values over intervals of 5 min to get a somewhat balanced dataset.However, for combined prediction, we used the averaging method since it was easier to synchronize the time intervals of glucose values and sensor recording than with the random under-sampling method.2) ECG Sensor Features: ECG signals have various essential components being recorded referred to as P wave, QRS complex, T wave, etc.Each of these waves indicates atrial polarization or depolarization and ventricle polarization, depolarization [5].The interval between the onset and offset of these waves results in interval-based features [17].These interval-based features are important because these are affected by the glucose level in the body such as the QT interval being prolonged in people with diabetes [5].Table II shows the interval-based features being used in this study and its description.Another set of features is time-domain features.Timedomain features refer to the analysis of signal or time-series data with respect to time.These features also play an important role in glucose prediction as they give crucial statistics related to heart responses [18].Glucose variations in the body also affect the HR, the HRV, and other statistics as well Table III shows the time-domain features and their description.Time-domain features are calculated using the RR interval (time duration between the two R wave peaks of an ECG signal) or NN interval (time duration between normal R peaks).In case of abnormal R peaks during signal measurement, to ensure reliable and valid data, these R-peaks are corrected and are referred to as normal R peaks.So, RR intervals and NN intervals are synonymous.
3) ACC Sensor Features: ACC sensor data consist of three axes referred to as vertical, lateral, and sagittal axes commonly known as the X -, Y -, and Z -axes.ACC sensor data helps in monitoring human activity.Human activity plays a significant role in the metabolism of glucose and significantly affects the blood glucose levels [6].In this study, we extracted time-domain statistical features from the three-axis ACC data [19].These features are mean, standard deviation, median, median absolute deviation, skewness, kurtosis, and interquartile range.We have also considered the features like signal magnitude area and energy of the signal.All these features are calculated in all three X -, Y -, and Z -axes.4) Breathing Sensor Features: Breathing sensors recorded the breath rate data.Limited studies have used breath-related data for diabetes prediction.Biomarkers, which have been used in previous studies for diabetes prediction, are extracted mostly through chemical sensors [7].So, for this study, we have used similar methods as used with ECG sensors for feature extraction.We engineered time-domain statistical features from the breath sensors waveform as mentioned in Table III.The features from the breath sensor data give information about the breath rate, maximum, minimum breath rate, mean, and standard deviation of breath rate.Time-domain features for breathing sensors are calculated using BB-interval (time duration between the peaks of a breath signal).
Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.

C. Machine Learning Analysis
To predict diabetes from the sensor data, the features extracted in the feature engineering step are given to various machine learning algorithms.Here, we have used various supervised learning algorithms for this task.This section describes in detail about different types of machine learning tasks performed and the algorithms that have been used.As specified in the conceptual framework as well in Fig. 1, we performed two tasks for the diabetes prediction.
2) Multisensor-based diabetes prediction.In single sensor-based prediction, we used the features from individual sensors calculated using five different window sizes 15 s, 30 s, 1 min, 2 min, and 5 min.We utilized a set of machine learning algorithms explored in a systematic literature review on machine learning algorithms being used in e-health sensor data [2].The features calculated from the three sensors were floating point values and the most frequently used supervised algorithms to analyze these values are Logreg [5], decision tree, random forest, SVC [1], AdaBoost, gradient boosting, XGBoost, MLP.From the study in [19], it has been observed that in the case of sensor data with time-domain statistical features tree-based algorithms such as random forest and ensemble algorithms such as XGBoost performed better than other algorithms.Moreover, SVCs also performed well with unbalanced classes [19].In the current study, we have also explored other ensemble boosting algorithms such as AdaBoost and gradient boosting.AdaBoost works with a decision tree as a base learner but sequentially corrects the errors from the last models [10].Similarly, in gradient boost, subsequent trees are built from the errors of previous trees [20].So boosting algorithms tend to generate a stronger model of the data.To overcome the chances of over-fitting and ensure that the model is generalizing well on unseen data, we trained our algorithms using repeated stratified k-fold cross-validation with ten repeats over dataset splits.We divided the data into 80% training and 20% testing and trained the model using repeated stratified k-fold cross-validation.The model obtained was evaluated on the testing dataset.The output of each algorithm is evaluated based on the accuracy metrics and the time complexity curves.Accuracy metric tells about the correctly predicted classes out of a total number of predictions and time complexity curves or performance curves tell about the time algorithms take to achieve that accuracy.The results from single sensor predictions are further discussed in Section V.
In multisensor-based predictions, the machine learning algorithms that performed well in single-sensor predictions are used to build models for multisensor prediction.Single sensor combination also evaluated the window size, which resulted in the best performance.Window sizes play an important role when the features from different sensor needs to be combined.The sensor combinations used in this study were two-sensor combinations, three-sensor combinations, and foursensor combinations.We applied feature-level fusion here to merge the features from different sensors as per the combination and the new feature set that emerged from the combination is trained on the machine learning algorithm, which performed best with individual sensor data.Feature fusion on sensor combinations has previously been explored in literature [19].Although the sensors were positional sensors rather than ehealth sensors, the sensor combination approach resulted in an increase in the accuracy of prediction as compared to the single sensor results.The results of the multisensor combination are presented in Section V.

V. RESULTS
This section describes in detail the results of applying machine-learning algorithm to the transformed features.We have summarized the diabetes prediction results using single sensors and multisensor combinations.The two sections below describe the results of using individual sensor data and combined sensor data for diabetes prediction.

A. Single Sensor Prediction Results
Table IV shows the individual sensor prediction rates and the percentage of false positives and false negatives obtained in that prediction.False positive here indicates percentage of samples predicted as diabetic but in actual it is non-diabetic and false negative refers to the percentage of samples predicted as non-diabetic but in actual it is diabetic.We observed that the algorithms that performed well using single sensor for diabetes prediction were ensemble algorithms such as Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.
XGBoost and gradient boost.Glucose data (when averaged over time intervals to match the time window for other sensors) could predict diabetes with an accuracy of 92.4% and a false positive rate of 2.49%.Moreover, ACC and ECG sensors also predicted diabetes with accuracies of 93.5% and 87.5%, respectively.For the ACC sensor, the false negative rate was minimal.So, it could be inferred that the time domain and interval-based features could model diabetes prediction well.However, breathing sensor-based predictions showed comparatively less accuracy with 61.8%, which implies that the features from breathing sensors did not contribute much to diabetes prediction.Moreover, the features generated from a window size of 5 min in all the sensors performed better as compared to other window sizes.
We also evaluated the performance of the models in terms of time complexity curves.Fig. 2 shows the performance or time complexity curves for glucose, ECG, ACC, and breathing sensors.The X -axis of the figure shows the time taken by the model to reach particular accuracy scores and the Y -axis of the figures shows the accuracies of the model.From the figure, it is observed that the algorithms mentioned in Table IV took less time to converge to their accuracies as compared to other algorithms which either took more time to converge or showed very little accuracy.We also observed that for glucose data with fewer features, the maximum time taken by algorithms was less as compared to the ECG, ACC, and breathing sensor data which had more features.

B. Multisensor Prediction Results
In multisensor prediction, we have evaluated the results for two-sensor combinations, three-sensor combinations, and four-sensor combinations.Table V shows the prediction rate and the percentage of false positives and false negatives obtained for two-sensor combinations, with the algorithms that performed best in that combination.For example, if we take glucose and ECG as the sensors whose features have been merged, then the algorithms that performed best with the individual features that are gradient boost and XGBoost are used to model the combined features.Among these two algorithms, XGBoost performed best.In this way, all the combinations are evaluated.From the two-sensor combinations we observed that the combination of glucose, ACC, and ECG, ACC showed the best performance with an accuracy of 96.8%.However, the combination of glucose and ACC gave the lowest false positive rate of 1.78% whereas ECG and ACC gave the lowest false negative rate of 3.55%.Sensor combinations having breathing sensors showed less performance when compared with the combinations including glucose, ECG, and ACC.However, in both the combinations, which performed best, XGBoost attained the highest accuracy.We can also state that the features of ACC sensor played an important role in diabetes prediction.There is also a significant increase of 3%-4% in the performance when we compare the single-sensor ACC (since it showed the highest performance) with the two-sensor combinations.However, when we observe the performance curves for glucose, ACC, and ECG, ACC in Fig. 3, it can be seen that the sensor combination using glucose and ACC converges faster as compared to ECG and ACC.This can be due to more number of features present in ECG and ACC data.
Table VI shows the prediction rate when three-sensor combinations and four-sensor combinations are considered along with false positive and false negative rates.In three-sensor combinations also we have evaluated the merged features  of sensor combinations using XGBoost and gradient boosting algorithms.From the table, it can be observed that the sensor's combinations with glucose, ECG, and ACC sensors have performed best with an accuracy of 98.2% with the XGBoost algorithm.An increase of 1%-1.5% can be seen in the performance of three-sensor combinations as compared with two-sensor combinations and 4.5%-5% of increase in the performance with a single sensor ACC.Table VI also shows the prediction rate and false positive, and false negative rate when all four sensors are considered.The accuracy of XGBoost when all sensor features are combined is 98.2%.We also observed that the accuracy scores, when all sensors are used and when three-sensors combination with glucose, ECG, and ACC are taken are the same.Also for the three-sensor combination using glucose, ECG, and ACC, the false positive and false negative rates were the lowest, that is, 1.07% and 2.77%, respectively.Moreover, if we observe the performance curve in Fig. 4 for three-sensor combinations using glucose, ACC, and ECG sensors and four-sensor combinations using glucose, ACC, and ECG sensors, it can be seen that both the combinations are converging to the same accuracy but the three-sensor combination is taking less time than the foursensor combinations.This could be because of extra features from the breathing sensor, which did not play any significant role in diabetes prediction.

VI. CONCLUSION
In this work, we focused on using multiple sensor data for predicting diabetes diseases using machine-learning algorithms.We explored different combinations of the health-sensors for better diabetes prediction.We also investigated which sensors and which combinations can predict better/with higher accuracy the diabetes disease.Moreover, we also evaluated the optimal window size for diabetes prediction using different sensor data.The dataset used for this work consisted of four types of health data namely glucose data, ECG data, ACC data, and breathing data.We found that a multisensor combination using glucose, ECG, and ACC sensors gives the highest prediction accuracy of 98.2% with the XGBoost algorithm and using a 5-min window size.multisensor combinations showed an increase of nearly 4%-5% in the diabetes prediction rates as compared to single-sensor predictions.We also observed that the breathing-sensor-related data have very little influence on the prediction of diabetes.We also evaluated the accuracy versus fit-time curves and found that a three-sensor combination using glucose, ECG, and ACC converges faster than a four-sensor combination while achieving the same accuracy.Although, the results generated from the system have some false negatives, the diabetes prediction results are most stable and consistent when the sensors with glucose data, ECG data, and ACC data are used in combinations.So, the system is also able to generate reliable results with fewer false negatives.

VII. HARDWARE AND SOFTWARE USED
To predict diabetes using multisensor data, we used Jupyter Notebook with Python version 3.For feature engineering of Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.
ECG and breathing signals, we used the software package hrv-analysis 1.0.4; for basic pre-processing, machine learning analysis, and visualization we used Python libraries such as sklearn, scipy, matplotlib, numpy, and pandas.

TABLE V TWO
-SENSOR-BASED PREDICTION Fig. 3. Performance curves for two-sensor prediction.

TABLE VI THREE
-FOUR SENSOR-BASED PREDICTION