Machine Learning Algorithms for Real-Time Analysis of Multimedia Data from IoT-Based Health Instruments for Diabetes Management

Machine Learning Algorithms for Real-Time Analysis of Multimedia Data from IoT-Based Health Instruments for Diabetes Management

Marvin Chandra Wijaya

Departement of Computer Engineering, Maranatha Christian University, Bandung 40164, Indonesia

Corresponding Author Email: 
marvin.cw@eng.maranatha.edu
Page: 
35-43
|
DOI: 
https://doi.org/10.18280/i2m.240104
Received: 
28 October 2024
|
Revised: 
24 January 2025
|
Accepted: 
12 February 2025
|
Available online: 
28 February 2025
| Citation

© 2025 The author. This article is published by IIETA and is licensed under the CC BY 4.0 license (http://creativecommons.org/licenses/by/4.0/).

OPEN ACCESS

Abstract: 

The rising prevalence of diabetes worldwide has prompted the need for innovative solutions that leverage advancements in technology to improve patient outcomes. This paper explores the application of machine learning algorithms to the real-time analysis of multimedia data from IoT-based health instruments for effective diabetes management. This research proposes a novel framework for real-time diabetes management by leveraging the power of wearable IoT devices, edge computing, and advanced machine learning techniques. Specifically, we utilize Recurrent Neural Networks, trained using backpropagation through time, to analyze temporal patterns in continuous glucose monitoring data and physical activity logs. This approach enables the system to predict and prevent episodes of hyperglycemia and hypoglycemia, providing personalized recommendations for insulin adjustments and dietary modifications. Evaluation results demonstrate the effectiveness of the proposed approach, achieving an 80% accuracy in classifying hypoglycemia, normal glucose levels, and hyperglycemia. Notably, the system exhibits high precision in identifying hyperglycemic events, indicating its potential in preventing severe complications. Further personalization and integration of additional health data are planned to enhance the system's accuracy and comprehensiveness.

Keywords: 

IoT, health instrument, diabetes management, machine learning

1. Introduction

The rapid advancements in Internet of Things technology have revolutionized the healthcare industry, enabling the development of innovative health monitoring instruments that can continuously collect and analyze a wide range of patient data [1]. These IoT-based health devices are particularly valuable for the management of chronic conditions, such as diabetes. Diabetes, a chronic metabolic disorder affecting millions globally, demands continuous monitoring and management of various factors, including blood glucose levels, physical activity, diet, and medication adherence [2]. The emergence of Internet of Things has revolutionized healthcare by enabling the development of smart, interconnected health instruments. These devices, such as continuous glucose monitors, smart insulin pens, and fitness activity trackers, generate a wealth of real-time data, offering unprecedented opportunities for personalized diabetes care. However, extracting meaningful insights from this vast and complex data requires advanced analytical techniques [3].

Real-time monitoring using IoT provides several advantages over conventional approaches. Firstly, it offers continuous insights into a patient's physiological parameters, enabling timely detection of critical events like hypoglycemia or hyperglycemia. This allows for proactive interventions, preventing severe complications and improving overall glycemic control. Secondly, the continuous data streams generated by IoT devices provide valuable feedback on the effectiveness of treatment plans, facilitating personalized adjustments to medication, diet, and exercise regimens. By leveraging of real-time data and intelligent algorithms, we can transition from a reactive to a proactive approach to diabetes management, improving the quality of life for individuals with diabetes while reducing the burden on healthcare systems [4]. The use of Multimedia can also provide convenience for its users [5].

This research explores the potential of machine learning algorithms in processing and analyzing multimedia data collected from IoT-based health instruments for enhanced diabetes management. By leveraging the power of machine learning, we aim to develop models capable of real-time prediction of glucose fluctuations, enabling timely interventions; generating personalized recommendations for diet, exercise, and medication adjustments; and early detection of potential complications, facilitating proactive healthcare interventions. An appropriate multimedia model needs to be researched to be integrated with health instruments [6].

A significant research gap exists in current diabetes management systems, which primarily rely on numerical data from IoT-based health instruments, such as glucose levels and heart rate, while neglecting real-time analysis of multimedia data, including images, voice inputs, and video recordings. The integration of machine learning for multimodal data fusion remains underexplored, particularly in real-time processing on resource-constrained IoT devices. Additionally, current models are often static and fail to adapt to individual health variations over time, limiting their personalization capabilities. Furthermore, security and privacy concerns in handling sensitive multimedia data have not been adequately addressed, highlighting the need for privacy-preserving machine learning techniques such as federated learning and differential privacy.

This research introduces a novel approach by integrating real-time machine learning algorithms for multimodal data analysis in IoT-based diabetes management, combining sensor data with images, voice, and videos for a more comprehensive health assessment. It proposes lightweight edge AI models optimized for real-time processing on IoT devices, ensuring efficiency and scalability. The system will leverage adaptive learning techniques to personalize predictions based on individual lifestyle patterns and health trends. Additionally, secure data processing methods, including federated learning, will be implemented to enhance privacy while maintaining accurate decision-making. This approach aims to transform diabetes management by enabling real-time, context-aware, and secure health monitoring.

2. Literature Review

2.1 IoT in diabetes management

The advent of the Internet of Things has sparked a paradigm shift in diabetes management, empowering both patients and healthcare providers with real-time insights and personalized interventions. IoT-enabled devices, such as continuous glucose monitors, smart insulin pens, and wearable activity trackers, have emerged as indispensable tools for continuous monitoring and data collection [7].

CGMs, for instance, have revolutionized blood glucose monitoring by providing dynamic readings throughout the day, eliminating the need for frequent finger-prick tests . These devices transmit real-time data to smartphones or dedicated receivers, enabling patients to track glucose trends, identify patterns, and make informed decisions regarding insulin dosage, meal planning, and physical activity [8].

Smart insulin pens, on the other hand, offer automated insulin delivery and dosage tracking, improving adherence to medication regimens and reducing the risk of hypoglycemia [9]. These pens can also integrate with CGMs to adjust insulin delivery based on real-time glucose levels, paving the way for closed-loop insulin delivery systems [10].

Furthermore, wearable activity trackers provide valuable data on physical activity levels, sleep patterns, and heart rate variability, all of which are crucial for managing diabetes and mitigating associated risks [11]. The integration of these diverse IoT devices creates a comprehensive ecosystem for personalized diabetes management, enabling data-driven insights and proactive interventions. Despite the wealth of data generated by IoT-based health instruments, the challenge lies in effectively processing and analyzing this information to derive meaningful insights.

2.2 Machine learning in diabetes

Machine learning has emerged as a powerful tool for analyzing complex medical data, and its application in diabetes management has shown significant promise [12]. Researchers have successfully employed various machine learning techniques, including regression models, neural networks, and reinforcement learning, to predict blood glucose levels, detect insulin sensitivity, and offer personalized recommendations based on lifestyle data [3].

Regression models, such as linear regression and support vector regression, have been widely used to predict future glucose levels based on historical data and other relevant factors [13]. Neural networks, particularly recurrent neural networks and long short-term memory networks, have demonstrated superior performance in capturing temporal dependencies and non-linear relationships within glucose data, leading to more accurate predictions [14].

Reinforcement learning, a type of machine learning that learns through trial and error, has shown potential in developing personalized insulin delivery strategies. By continuously learning from the patient's glucose responses to insulin and other factors, reinforcement learning algorithms can optimize insulin dosages in real-time, mimicking the function of a closed-loop insulin delivery system [15].

The integration of machine learning with IoT-based health instruments holds immense potential for transforming diabetes management. By leveraging the predictive power of machine learning, healthcare providers can develop personalized interventions, improve patient outcomes, and reduce the burden of this chronic condition.

2.3 Challenges in real-time monitoring

Despite the advancements in IoT and machine learning, real-time monitoring and analysis of multimedia data for diabetes management present significant challenges. Processing vast amounts of data generated by multiple sensors while ensuring accurate and timely predictions of blood glucose fluctuations remains a complex task [16].

Delays in data transmission, processing, or prediction can have serious consequences for individuals with diabetes. For instance, a delay in predicting a hypoglycemic event could prevent timely intervention, potentially leading to severe complications such as loss of consciousness or seizures [17]. Similarly, inaccurate predictions of hyperglycemia could result in inappropriate insulin administration, leading to hypoglycemia or other adverse effects [18].

Ensuring real-time monitoring systems' reliability, robustness, and accuracy is paramount for their successful implementation in clinical practice. Addressing data quality, algorithm optimization, and system latency challenges is crucial for developing effective and trustworthy solutions for real-time diabetes management.

Muhammad Mulhim Md Jani presents the development of a weight system and real-time monitoring platform for tracking the activity patterns of a stingless bee colony. The system, using an microcontroller, load cells, and an RTC module, is designed with enhanced stability and allows continuous mobile monitoring via the Blynk app. Data shows peak foraging activity between 9:00 AM and 1:00 PM, with occasional evening activity. Correlation analysis of weight fluctuations helps beekeepers understand foraging patterns, which can be linked to bee activity, human interference, or environmental factors. This IoT-based system aids in improving hive management, monitoring bee health, and optimizing honey production [19].

3. Methodology

Effective diabetes management necessitates the continuous monitoring of multiple health metrics, including blood glucose levels, insulin administration, dietary intake, and physical activity. While IoT-based instruments can gather this data consistently, the challenge lies in real-time analysis to generate actionable insights. Traditional diabetes management approaches rely on intermittent monitoring and retrospective evaluation, which may fail to capture critical glucose fluctuations or anticipate complications in a timely manner. Machine learning models designed to process multimedia data can offer more accurate and personalized solutions for diabetes management.

The objectives of this research are to develop machine learning models for real-time analysis of glucose levels, insulin use, and lifestyle data collected from IoT devices for diabetes management. These models will be optimized to predict episodes of hyperglycemia or hypoglycemia based on real-time data. Additionally, the research aims to explore the use of multimedia data, such as diet images, physical activity videos, and glucose trends, to offer personalized health recommendations for diabetes patients.

This research will employ a multifaceted methodology encompassing data collection, machine learning model development, real-time processing framework implementation, and rigorous evaluation.

3.1 Diabetes management tools integration and workflows

The proposed machine learning-based system for real-time analysis of multimedia data from IoT-based health instruments can be seamlessly integrated with existing diabetes management tools and workflows. This integration leverages technologies like IoT, cloud computing, and machine learning, allowing the system to work alongside current diabetes solutions to enhance real-time decision-making, provide personalized recommendations, and automate insulin delivery.

The system can connect with existing IoT-based devices such as Continuous Glucose Monitors (CGMs), smart insulin pumps, activity trackers, and heart rate monitors that patients are already using. These devices collect continuous data on blood glucose levels, insulin delivery, physical activity, heart rate, and other vital metrics. Through Bluetooth or Wi-Fi connectivity, the system can pull data from these devices into a centralized cloud platform for processing and analysis. For instance, CGMs provide real-time glucose data, which the system can analyze to identify trends and make predictions. Smart insulin pumps can synchronize their data with the system, allowing for automated adjustments based on glucose trends and activity levels. Data from wearables, including activity trackers and heart rate monitors, is also integrated, enabling the system to predict glucose fluctuations based on physical activity and stress levels.

Once the data is collected, it is sent to the cloud for centralized processing and storage. The system uses machine learning models and real-time analytics to process the data and generate actionable insights. For example, the system can predict hypoglycemic episodes, suggest insulin dosage adjustments, or alert the patient about activity-induced glucose fluctuations. In addition, the system can handle missing or inconsistent data from IoT devices using deep learning-based imputation techniques, ensuring that the diabetes management process remains accurate even in the case of sensor failures.

The system can also interface with existing mobile apps or patient portals commonly used in diabetes management. Through these platforms, patients and healthcare providers can access real-time data, receive alerts, and review insights on glucose levels, activity, and insulin use. The system can send real-time alerts to patients if their blood sugar is approaching dangerous levels, prompting them to take corrective actions such as insulin injections or eating. Data visualization tools within the app provide trends in glucose levels, insulin usage, and other health metrics, helping both patients and healthcare providers monitor and adjust their diabetes management strategies.

Furthermore, the system can be integrated with Electronic Health Records (EHR) systems used by healthcare providers. This integration facilitates the easy sharing of patient data, allowing healthcare providers to view real-time insights alongside the patient’s historical health data. Providers can make informed decisions about treatment adjustments based on the system's recommendations and the patient’s ongoing health trends. The integration also ensures compliance with data privacy regulations, protecting patient confidentiality while enabling data-driven decision-making.

One of the significant advantages of the proposed system is its ability to continuously learn from the patient’s data and the outcomes of previous decisions. As more data is gathered, the machine learning models are retrained to improve the accuracy of predictions and recommendations. Federated learning ensures that the patient’s data remains private, contributing to the improvement of the models without centralizing sensitive information. This personalized approach allows the system to continuously adapt to the patient’s changing health status, preferences, and lifestyle.

For patients using smart insulin pumps, the system can offer automated insulin delivery adjustments based on real-time glucose data and activity levels. This integration creates a closed-loop system, where the insulin pump communicates with the CGM to adjust insulin delivery automatically. This functionality essentially turns the system into an Artificial Pancreas, providing automatic insulin adjustments to maintain optimal blood glucose levels.

3.2 Data collection

A diverse dataset will be assembled through the use of various IoT devices and digital platforms:

  • IoT Devices:
    • Continuous Glucose Monitors: Utilized to capture continuous blood glucose measurements.
    • Insulin Pumps/Smart Insulin Pens: Employed to record insulin administration data.
    • Wearable Sensors: Leveraged to collect physical activity information.
  • Digital Platforms:
    • Smartphone Applications: Used in conjunction with multimedia data to log and analyze dietary intake.

This research proposes a comprehensive system for personalized diabetes management using advanced machine-learning techniques and real-time data. The system will leverage continuous glucose monitors, physical activity logs, and dietary intake records to predict and prevent episodes of hyperglycemia and hypoglycemia as shown in Figure 1 [20]. By employing reinforcement learning models, personalized recommendations for insulin adjustments and dietary modifications will be generated. Additionally, deep learning models will integrate multimedia data, such as food intake images and activity data, to provide a holistic management plan. The use of proper and good biosensors will increase the accuracy of data collection [21].

Figure 1. Continuous glucose monitor (CGM)

An insulin pump is a small, computerized medical device that continuously delivers insulin to individuals with diabetes, particularly those with Type 1 and some with Type 2 diabetes requiring intensive insulin therapy as shown in Figure 2. It mimics the natural insulin release by providing a basal dose throughout the day and bolus doses before meals or to correct high blood sugar. The device consists of a pump, an insulin reservoir, and an infusion set that delivers insulin through a small cannula inserted under the skin. Compared to multiple daily injections, insulin pumps offer more precise insulin delivery, improved blood sugar control, and greater flexibility in lifestyle, though they require regular monitoring and maintenance to prevent issues like pump failure or infection. Modern IoT-enabled smart pumps integrate with Continuous Glucose Monitors (CGMs) and AI-driven algorithms, creating an Artificial Pancreas System (APS) that automatically adjusts insulin doses based on real-time glucose readings, significantly enhancing diabetes management.

Figure 2. Insulin pump

The AI-powered monitoring wearable would act as a personalized diabetes management assistant, offering real-time, adaptive, and automated insights to improve glucose control while reducing the burden of manual tracking.

A robust real-time processing framework will be established using high speed computing for the immediate processing of critical data and cloud integration for long-term analysis. This approach aims for individuals with diabetes condition to effectively manage their condition and improve the quality of their overall health outcomes.

3.3 Machine learning models

Advanced machine learning techniques will be employed to analyze the collected data and provide actionable insights:

  • Glucose Forecasting: Time-series analysis methods and regression models, such as Recurrent Neural Networks and Long Short-Term Memory networks, will be utilized to predict future blood glucose levels based on historical data, encompassing glucose trends, insulin administration, and activity patterns.
  • Hypoglycemia and Hyperglycemia Detection: Classification algorithms will be implemented to identify and forecast episodes of hyperglycemia or hypoglycemia in a timely manner. These algorithms will leverage real-time data from Continuous Glucose Monitors, physical activity logs, and dietary intake records.
  • Personalized Recommendations: Reinforcement learning models will be employed to generate personalized recommendations, including insulin adjustments and dietary modifications, tailored to the patient's unique health profile and real-time data.
  • Multimedia Integration: Deep learning models will be explored to process multimedia data, such as food intake images and activity data, integrating them with physiological information to provide a comprehensive and personalized management plan.

Recurrent Neural Networks differ from conventional multi-layer perceptron networks in two crucial ways as shown in Figure 3. Firstly, RNNs have a memory-like capability, allowing them to incorporate previous inputs and patterns when processing new information. Secondly, RNNs employ the same parameters or weights across different steps of the input sequence, which enables them to generalize and learn temporal dependencies more efficiently. The hidden states, represented by the green blocks, comprise hidden nodes or units, symbolized by the blue circles labeled 'a'. The hyperparameter 'd' specifies the number of these hidden nodes. Each hidden state can be conceptualized as an activation function, analogous to those employed in multilayer perceptrons, operating on the individual blue nodes. The computational intricacies within the hidden states will be further elaborated upon in the subsequent section on forward propagation.

Figure 3. The architecture of an RNN

The matrices Wx, Wh, and Wy represent the weights within the RNN architecture. These weights are shared across all time steps in the network. This means that the values of Wx at time step t=1 are identical to the values of Wx at t = 2 and all other time steps. This weight-sharing mechanism is a fundamental characteristic of RNNs, enabling them to learn and generalize temporal patterns effectively.

The vector h represents the output of a hidden state after an activation function has been applied to its hidden nodes. Notably, at any given time step t, the architecture incorporates information from the previous time step (t-1) by considering both the previous hidden state's output (h) and the current input (x). This mechanism allows the network to retain and utilize information from previous inputs in a sequential manner. It's important to highlight that the initial h vector, at time step zero, is always initialized as a vector of zeros. This is because, at the beginning of the sequence, there is no preceding information for the algorithm to consider.

The matrices Wx, Wy, and Wh represent the weights of the RNN. These weights are shared, meaning they remain the same across all time steps. For instance, the values of Wx at time step t=1 are identical to the values of Wx at t=2 and every other time step as shown in Figure 4. This weight-sharing characteristic is crucial for RNNs to learn and generalize temporal patterns effectively.

Figure 4. The hidden state at time step t=2 receives input from two sources: the output of the hidden state at the previous time step (t-1) and the current input (x) at time step t=2

The vector xᵢ represents the input provided to each hidden state in the sequence. The subscript 'i' denotes the position of the element within the input sequence, where 'i' ranges from 1 to 'n'. It's crucial to remember that textual data needs to be converted into a numerical format for processing. For instance, each letter in the word "dogs" could be represented as a one-hot encoded vector with dimensions (4×1). Similarly, x can also be represented using word embeddings or other suitable numerical representations.

The recurrent neural network architecture involves three key equations:

  • The hidden nodes are computed by combining the weighted output of the previous state (multiplied by the weight matrix WH) with the weighted current input (multiplied by the weight matrix WX) as Eq. (1).
  • The tanh activation function, represented by the green block, is applied to the hidden nodes to obtain the output of the hidden state as Eq. (2).
  • To generate a prediction, the hidden state output is multiplied by the weight matrix Wy, and then a softmax activation function is applied as Eq. (3).

at=WHht1+WXXt              (1)

ht=tanh(at)            (2)

yt=Softmax(WYht)             (3)

where, at=Hidden notes; ht=Output from hidden state; yt=Prediction time t.

Similar to Multilayer Perceptron, Recurrent Neural Networks leverage the backpropagation algorithm to learn from sequential data. However, backpropagation in RNNs presents a greater challenge due to the recursive nature of weights and their impact on the loss function across time. The general workflow of backpropagation in RNNs involves randomly initializing the weight matrices, followed by forward propagation to generate predictions. Subsequently, the loss is computed, and backpropagation is performed to determine the gradients. Finally, the weights are updated based on these gradients. This cyclical process, from forward propagation to weight updates, is reiterated iteratively. Multi-class cross-entropy loss function as Eq. (4) and total loss as Eq. (5) and Figure 5 shows the RNN with entropy loss function.

Lt(yt,ˆyt)=ytlog(ˆyt)             (4)

Ltotal (y,ˆy)=nt=1ytlog(ˆyt)               (5)

Figure 5. RNN with entropy loss function

3.4 Real-time processing framework

A robust and efficient real-time processing framework will be established to manage the continuous influx of data:

  • Edge Computing: Edge computing will be leveraged for real-time processing of glucose and activity data directly on wearable devices. This approach facilitates faster predictions and alerts for potentially hazardous glucose fluctuations, such as hypoglycemic events.
  • Cloud Integration: Cloud-based systems will be utilized for processing non-critical data and conducting long-term health trend analysis. This integration enables the generation of periodic reports and personalized insights for both healthcare providers and patients.
  • Model Optimization: Lightweight machine learning models will be implemented to ensure efficient operation on IoT devices with limited computing resources. This optimization ensures real-time predictions without compromising accuracy.

Table 1. Data experiments

Patient ID

Blood Glucose (mg/dL)

Insulin Dosage (Units)

Heart Rate (bpm)

Step Count

Calories Intake (Image Analysis)

Exercise Type (Video)

Prediction (Hypo/Hyperglycemia)

P001

100

6

78

2500

400

Yoga

Normal

P002

145

8

85

4500

600

Running

Hyperglycemia

P003

120

7

72

6000

300

Cycling

Normal

P004

95

5

68

2000

250

Walking

Hypoglycemia

P005

160

9

90

5000

800

Running

Hyperglycemia

P006

130

6

75

3500

400

Swimming

Normal

P007

110

4

80

2200

350

Walking

Normal

P008

180

10

100

5500

900

Aerobics

Hyperglycemia

P009

140

7

78

4000

500

Cycling

Normal

...

...

...

...

...

...

...

...

A wearable IoT device is a smart, internet-connected apparatus that can be worn on the body to continuously monitor, collect, and transmit data. In the context of diabetes management, these wearable IoT devices play a critical role in tracking essential health metrics, such as blood glucose levels, physical activity, heart rate, and dietary factors. These devices enable real-time analysis, predictive modeling, and alerts, empowering patients to manage their condition more effectively.

3.5 Handles missing or inconsistent data from IoT devices

In real-time diabetes management using IoT devices, missing data can arise due to various reasons such as sensor malfunctions, transmission issues, or user non-compliance (e.g., removing a wearable device). Deep learning-based imputation offers a sophisticated solution for handling such gaps in data by leveraging advanced models that can learn complex temporal patterns and relationships among physiological signals like glucose levels, heart rate, activity levels, and meal intake.

Recurrent Neural Networks (RNNs), particularly Long Short-Term Memory (LSTM) networks, are effective for this purpose as they are designed to handle time-series data. LSTMs can learn sequential dependencies within historical glucose and activity data, which is crucial for diabetes management. When missing values are detected, the LSTM model predicts the missing data based on previous and future trends. For instance, if glucose readings are missing for a short period, the LSTM can predict the values using the trend from past glucose levels, heart rate data, and activity patterns. This ensures that even if data is lost, the predictions remain consistent with the patient’s health trends.

In diabetes management, LSTMs can be applied to predict and impute missing glucose readings, analyze trends in heart rate, and provide personalized recommendations based on sequential sensor data. For example, if glucose readings are missing for a certain period, the LSTM model can predict the missing values by learning from the previous readings and other factors, such as meal intake, insulin administration, and physical activity. This makes LSTMs particularly valuable for real-time analysis in IoT-based health devices, as they ensure accurate data interpretation and decision-making even when some data is missing or inconsistent.

4. Results

The proposed framework demonstrates significant improvements in real-time diabetes management compared to traditional approaches. The key results are shown in Table 1.

Continuous glucose monitoring and activity tracking through wearable IoT devices have shown promising results in improving diabetes. Such systems can provide real-time insights to patients and healthcare providers, enabling timely interventions to prevent complications. A large-scale real-time glucose monitoring system has been developed, which ingests data from sensors, insulin, and meal information from patient apps, and activity levels from phone sensors. This system demonstrated improvements in patient health, with reduced periods of hyper- and hypoglycemia. Recent trends in IoT-based solutions for healthcare highlight the move towards edge computing, where analytics and predictions are performed directly on IoT devices. This approach ensures faster response times and reduces the reliance on cloud infrastructure.

Testing was carried out on 30 patients, and then the accuracy was measured using a confusion matrix, as shown in Table 2, with the interpretation as follows.

Table 2. Confusion matrix

 

Predicted: Hypoglycemia

Predicted: Normal

Predicted: Hyperglycemia

Actual: Hypoglycemia

7

1

0

Actual: Normal

1

9

2

Actual: Hyperglycemia

0

2

8

  • True Positives (TP):
    • Hypoglycemia: The model correctly predicted 7 cases where the patient was actually experiencing hypoglycemia.
    • Normal: The model correctly predicted 9 cases of normal glucose levels.
    • Hyperglycemia: The model correctly predicted 8 cases of hyperglycemia.
  • False Positives (FP):
    • Hypoglycemia: There was 1 case where the patient was normal, but the model incorrectly predicted hypoglycemia.
    • Normal: There were 2 cases where the patient was hyperglycemic, but the model incorrectly predicted normal glucose levels.
    • Hyperglycemia: The model did not incorrectly predict hyperglycemia when the patient was actually hypoglycemic or normal.
  • False Negatives (FN):
    • Hypoglycemia: The model failed to detect 1 case of hypoglycemia, predicting it as normal.
    • Normal: The model misclassified 2 cases of normal glucose levels as hyperglycemia.
    • Hyperglycemia: The model failed to detect 2 cases of hyperglycemia, predicting them as normal.

Performance metrics derived from the Confusion Matrix:

  • Accuracy:

Accuracy = (7 + 9 + 8) / 30 = 24 / 30 ≈ 80%

  • Precision (for each class):
    • Hypoglycemia:

Precision = 7 / (7+1) = 87.5%

  • Normal:

Precision= 9 / (9+2) ≈81.8%

  • Hyperglycemia:

Precision= 8 / (8+0) = 100%

  • Recall (for each class):
    • Hypoglycemia:

Recall = 7 / (7+1) = 87.5%

  • Normal:

Recall= 9 / (9+2) ≈81.8%

  • Hyperglycemia:

Recal= 8 / (8+2) = 80%

  • F1 Score (harmonic mean of precision and recall):
    • Hypoglycemia:

F1 Score = 2 × (0.875 x 0.875) / (0.875 +0.875) = 87.5%

  • Normal:

F1 Score = 2 × (0.818 x 0.818) / (0.818 +0.818) ≈ 81.8%

  • Hyperglycemia:

F1 Score = 2 × (1.00 x 0.80) / (1.00 +0.80) ≈ 88.9%

Summary of the model's performance:

  • Accuracy is 80%, which means the model is correct in 24 out of 30 cases.
  • The model performs well in predicting hyperglycemia with a precision of 100%, though it misses some cases with a recall of 80%.
  • Hypoglycemia prediction is strong with a precision and recall of 87.5%.
  • The model struggles slightly with normal glucose levels, where both precision and recall are around 81.8%, indicating some misclassifications between normal and hyperglycemia.

This confusion matrix provides a clearer understanding of how well the machine learning model performs across different glucose levels and where improvements can be made.

Table 3 shows the comparison between the prosposed study and existing studies.

The proposed machine learning-based system for real-time IoT-based health data analysis can significantly improve patient outcomes and healthcare costs. By continuously monitoring glucose levels, insulin delivery, and other health metrics, the system can detect fluctuations and predict potential hypoglycemic or hyperglycemic events, enabling early intervention and reducing the risk of complications such as neuropathy, retinopathy, and cardiovascular disease. Personalized treatment recommendations based on individual data ensure better management of diabetes, improving patient adherence and reducing the likelihood of emergency situations like severe hypoglycemia or diabetic ketoacidosis.

Table 3. Comparison with existing studies

Existing Studies

The Differences

"Integration of IoT and MLA In Prediction of Diabetes: An Overview" [22]

The existing study explores how IoT devices and machine learning algorithms can be used to predict diabetes, focusing on data collection, preprocessing, and classification. While this study provides a broad overview of IoT-based diabetes prediction, it lacks real-time glucose monitoring, predictive analytics for glucose fluctuations, and automated insulin adjustment, which are key aspects of the proposed system.

“An IoT Based diabetic patient Monitoring System Using Machine Learning and Node MCU” [23]

The existing study focuses on remote monitoring of diabetic patients using IoT sensors and machine learning techniques. While it provides a foundation for diabetes monitoring, it lacks real-time glucose prediction, advanced deep learning models, and automated insulin regulation, which are the key advancements in the proposed system.

“IoT and Machine Learning-Based Self-Care System for Diabetes Monitoring and Prediction” [24]

The existing study focuses on non-invasive monitoring of diabetic patients using IoT sensors and machine learning models to predict potential diabetic events. While this study aims to improve diabetes management through self-care recommendations, it lacks real-time glucose prediction, adaptive learning, and closed-loop insulin adjustment, which are key strengths of the proposed system.

The system also enhances patient quality of life by providing continuous monitoring and real-time alerts, helping patients maintain stable glucose levels with fewer blood sugar swings. Integration with mobile apps and patient portals increases patient engagement, allowing them to actively track their health and make informed decisions. From a healthcare cost perspective, the system can reduce hospitalizations, emergency care, and long-term complications by offering early intervention and proactive care. It allows healthcare providers to monitor patients remotely, optimize resources, and reduce unnecessary tests and visits, leading to lower operational costs.

By preventing complications such as kidney disease, nerve damage, and cardiovascular issues, the system helps reduce the high costs associated with chronic care. It also ensures more efficient medication management, preventing insulin overuse and lowering drug costs. The system offers a cost-effective, preventive approach to diabetes care, improving patient outcomes and reducing long-term healthcare expenses.

5. Conclusions

This research presents a robust framework for real-time diabetes management leveraging wearable IoT devices, edge computing, and machine learning. The system successfully integrates real-time data from continuous glucose monitors, physical activity trackers, and dietary intake records to provide personalized insights and timely interventions.

The evaluation results, including the confusion matrix analysis, demonstrate the effectiveness of the proposed approach. With an accuracy of 80%, the model accurately predicts and classifies different glycemic states, including hypoglycemia, normal glucose levels, and hyperglycemia. Notably, the model exhibits high precision in identifying hyperglycemic events, indicating its potential in preventing severe complications. While the model demonstrates strong performance overall, there's room for improvement in distinguishing between normal and hyperglycemic cases, as observed in the confusion matrix.

Future work will focus on enhancing the model's accuracy in classifying borderline cases and further personalizing the system based on individual patient characteristics and lifestyle factors. Additionally, integrating data from other sources, such as sleep patterns and stress levels, could provide a more comprehensive understanding of individual glycemic control.

Acknowledgment

This research was supported by Departement of Computer Engineering, Maranatha Christian University, Indonesia.

  References

[1] Sidey-Gibbons, J.A., Sidey-Gibbons, C.J. (2019). Machine learning in medicine: A practical introduction. BMC Medical Research Methodology, 19: 1-18. https://doi.org/10.1186/s12874-019-0681-4

[2] Cappon, G., Acciaroli, G., Vettoretti, M., Facchinetti, A., Sparacino, G. (2017). Wearable continuous glucose monitoring sensors: A revolution in diabetes treatment. Electronics, 6(3): 65-81. https://doi.org/10.3390/electronics6030065

[3] Nguyen, T.N., Rokicki, M. (2018). On the predictability of non-CGM diabetes data for personalized recommendation. In Proceedings of ACM CIKM 2018 Workshops, pp. 1-7. https://doi.org/10.48550/arxiv.1808.07380

[4] Kumari, M., Gaikwad, M., Chavan, S.A. (2024). Review on open-source IoT and edge-compatible devices for health monitoring applications. Instrumentation Mesure Métrologie, 23(3): 233-241. https://doi.org/10.18280/i2m.230307

[5] Wijaya, M.C., Maksom, Z., Abdullah, M.H.L. (2021). A brief of review: Multimedia authoring tool attributes. Ingénierie des Systèmes d’Information, 26(1): 1-11. https://doi.org/10.18280/isi.260101

[6] Wijaya, M.C., Maksom, Z., Haziq, M., Abdullah, L. (2022). A brief review: Multimedia authoring modeling. Journal of Information Hiding and Multimedia Signal Processing, 13(1): 39-48.

[7] Heintzman, N.D., Kleinberg, S. (2016). Using uncertain data from body-worn sensors to gain insight into type 1 diabetes. Journal of Biomedical Informatics, 63: 259-268. https://doi.org/10.1016/j.jbi.2016.08.022.

[8] Klonoff, D.C. (2006). Continuous glucose monitoring technology delivers detailed diabetes data. Point of Care the Journal of Near-Patient Testing & Technology, 5(3): 105-111. https://doi.org/10.1097/01.poc.0000232577.13891.d3

[9] Sangave, N.A., Aungst, T.D., Patel, D. (2019). Smart connected insulin pens, caps, and attachments: A review of the future of diabetes technology. Diabetes Spectrum, 32(4): 378-384. https://doi.org/10.2337/ds18-0069

[10] Li, J., Liang, J.Y., Laken, S.J., Langer, R., Traverso, G. (2020). Clinical opportunities for continuous biosensing and closed-loop therapies. Trends in Chemistry, 2(4): 319-340. https://doi.org/10.1016/j.trechm.2020.02.009

[11] Reddy, R.K., Pooni, R., Zaharieva, D.P., Senf, B., El Youssef, J., Dassau, E., Doyle III, F.J., Clements, M.A., Rickels, M.R., Patton, S.P., Castle, J.R., Riddell, M.C., Jacobs, P.G. (2018). Accuracy of wrist-worn activity monitors during common daily physical activities and types of structured exercise: Evaluation study. JMIR mHealth and uHealth, 6(12): e10338. https://doi.org/10.2196/10338

[12] Feldman, K., Faust, L., Wu, X., Huang, C., Chawla, N.V. (2017). Beyond volume: The impact of complex healthcare data on the machine learning pipeline. In Towards Integrative Machine Learning and Knowledge Extraction, pp. 150-169. https://doi.org/10.1007/978-3-319-69775-8_9

[13] Bunescu, R., Struble, N., Marling, C., Shubrook, J.H., Schwartz, F. (2016). Blood glucose level prediction using physiological models and support vector regression. In 2016 38th Annual International Conference of the IEEE Engineering in Medicine and Biology Society, pp. 2990-2993. https://doi.org/10.1109/icmla.2013.30

[14] Martinsson, J., Schliep, A., Eliasson, B., Mogren, O. (2019). Blood glucose prediction with variance estimation using recurrent neural networks. Journal of Healthcare Informatics Research, 4(1): 1-18. https://doi.org/10.1007/s41666-019-00059-y

[15] Myhre, J.N., Launonen, I., Wei, S., Godtliebsen, F. (2018). Controlling blood glucose levels in patients with type 1 diabetes using fitted Q-iterations and functional features. In 2018 IEEE 28th International Workshop on Machine Learning for Signal Processing, pp. 1-6. https://doi.org/10.1109/mlsp.2018.8516946

[16] Alfandi, O. (2022). An intelligent IoT monitoring and prediction system for health critical conditions. Mobile Networks and Applications, 27(3): 1299-1310. https://doi.org/10.1007/s11036-021-01892-5

[17] Jangam, S.R., Hayter, G., Dunn, T.C. (2013). Impact of glucose measurement processing delays on clinical accuracy and relevance. Journal of Diabetes Science and Technology, 7(3): 660-668. https://doi.org/10.1177/193229681300700311

[18] Elliott, M., Schafers, S.J., McGill, J.B., Tobin, G.S. (2012). Prediction and prevention of treatment-related inpatient hypoglycemia. Journal of Diabetes Science and Technology, 6(2): 302-309. https://doi.org/10.1177/193229681200600213

[19] Jani, M.M.M., Hairuddin, M.A., Ja’afar, H., Rustam, I., Almisreb, A.A., Ashar, N.D.K. (2024). Real-time IoT-blynk application for log hive weight monitoring in stingless bees. Instrumentation Mesure Métrologie, 23(2): 93-102. https://doi.org/10.18280/i2m.230202

[20] Ribet, F., Stemme, G., Roxhed, N. (2018). Real-time intradermal continuous glucose monitoring using a minimally invasive microneedle-based system. Biomed Microdevices, 20(4): 1-10. https://doi.org/10.1007/s10544-018-0349-6

[21] Jasim, F.A., Kadhum, F.J., Merza, M.N., Al-Saleh, A.M., Al-Zuky, A.A., Mirza, N.M. (2024). Simulation and analysis of the SnSe/Au nanolayer using SPR technique for biosensing applications. Instrumentation Mesure Métrologie, 23(5): 403-411. https://doi.org/10.18280/i2m.230508

[22] Prathap, A., Priyadarsini, J. (2021). Integration of IoT and MLA in prediction of diabetes: An overview. International Journal of Scientific Research in Computer Science, Engineering and Information Technology, 146-153. https://doi.org/10.32628/CSEIT217629

[23] Amine, R., Naja, A., Lloret, J., Oumnad, A. (2021). An IoT based diabetic patient monitoring system using machine learning and node MCU. Journal of Physics: Conference Series, 174312035. https://doi.org/10.1088/1742-6596/1743/1/012035

[24] Hebbale, A., Vinay, G.H.R., Krishna, B.V.N.V., Shah, J. (2021). IoT and machine learning based self care system for diabetes monitoring and prediction. In 2021 2nd Global Conference for Advancement in Technology (GCAT), pp. 1-7. https://doi.org/10.1109/GCAT52182.2021.9587681