CC BY 4.0 · Indian Journal of Neurotrauma
DOI: 10.1055/s-0045-1806943
Original Article

Machine Learning–Based Calibration of Commercial Continuous Glucose Monitoring Sensor in Nonserum Solutions: An In Vitro Validation Study

Megha Gautam
1   Department of Neurosurgery, All India Institute of Medical Sciences, New Delhi, India
,
Aditya Choudhary
1   Department of Neurosurgery, All India Institute of Medical Sciences, New Delhi, India
,
1   Department of Neurosurgery, All India Institute of Medical Sciences, New Delhi, India
› Author Affiliations
Funding This study was funded by IITI DRISHTI CPS Foundation, IIT Indore.
 

Abstract

Background

Continuous glucose monitoring (CGM) systems, such as the FreeStyle Libre Pro (Abbott Diabetes Care), offer noninvasive glucose measurement. However, their accuracy in cerebrospinal fluid (CSF) glucose monitoring remains unvalidated. This study evaluates the performance of the FreeStyle Libre sensor against a standard laboratory analyzer and proposes a regression-based calibration model to enhance measurement accuracy in neurotrauma ICU.

Materials and Methods

A FreeStyle Libre sensor was integrated into an experimental setup using an adapter. Sensor readings were recorded with glucose concentrations ranging from 50 to 275 mg/dL. A standard laboratory analyzer was used as the reference. A linear regression model was trained to correct sensor deviations, with interpolation (SciPy's interp1d) used for refined predictions. Real-time data acquisition was facilitated via Universal asynchronous receiver / transmitter (UART)-based serial communication, and adaptive learning enabled model retraining upon accumulating 10 sensor laboratory value pairs.

Results

Initial sensor readings exhibited significant deviations from laboratory values, particularly at lower glucose concentrations (mean absolute relative difference [MARD]: 30.45%). Postcalibration, the MARD was reduced to 8.92%, demonstrating improved accuracy. Interpolation further minimized deviations, correcting values such as 40 mg/dL (20% deviation) to 49.1 mg/dL (1.8% deviation) and 72 mg/dL (42.4% deviation) to 123.5 mg/dL (1.2% deviation). Adaptive learning progressively reduced the root mean square error (RMSE) from 23.7 to 9.8 mg/dL after 30 updates.

Conclusion

The calibration model makes the FreeStyle Libre sensor more accurate for CSF glucose measurements. This method might be promising for monitoring CSF glucose continuously of patients with external ventricular drainage, improving patient care in the neurotrauma ICU.


#

Introduction

To meet the essential requirements for long-term biosensor use in free-living conditions, such as biocompatibility and specificity, the glucose oxidation reaction has become the most widely employed technique in continuous glucose monitoring (CGM) systems.[1] CGM devices utilizing this mechanism incorporate a platinum electrode doped with glucose oxidase, embedded in a needle inserted into the subcutaneous tissue. This configuration facilitates and catalyzes the oxidation of glucose, producing gluconolactone, hydrogen peroxide, and an electrical current. The electrical signal is then transformed into glucose concentration values through a calibration process that requires a few self-monitoring of blood glucose samples collected by the patient.[2] [3]

CGM sensors provide near-continuous glucose monitoring, offering blood glucose readings every 15 minutes, and have demonstrated significant potential in outpatient and critical care settings.[4] The FreeStyle Libre sensor, a widely used CGM device, offers real-time glucose readings through an interstitial fluid-based electrochemical approach.[5] However, its application in nontraditional setups such as cerebrospinal fluid (CSF), where glucose levels can provide critical insights into patient metabolism and response to treatment, has not been validated. This study aims to evaluate the sensor's performance in such a unique configuration.

Sensor-based glucose measurement is prone to various sources of error, including sensor drift, environmental variability, interpatient physiological differences, and device-specific inaccuracies. Studies have reported that uncalibrated glucose sensors can deviate from laboratory values by more than approximately 20%, particularly in low-glucose conditions, which are critical in diagnosing hypoglycorrhachia-associated disorders.[6] [7]

FreeStyle Libre Pro does not require calibration with finger prick glucose tests, as it has a propriety algorithm to correct for deviations.[8] To address these discrepancies, machine learning–based calibration models have gained interest in the biomedical field, offering dynamic correction mechanisms that align sensor outputs with reference laboratory values in real time. Such models leverage regression techniques, interpolation, and adaptive learning to minimize errors and improve the reliability of continuous biosensor monitoring.

The FreeStyle Libre system employs an algorithm to determine sensor glucose levels. The manufacturer has confirmed modifications to this algorithm from the first to the third generation. While no proportional bias was detected in measurements using the generation 3 algorithm, such bias was observed with the generation 1 algorithm.[9]

The specific measurement algorithms for FreeStyle Libre and FreeStyle Libre Pro have not been publicly disclosed, and the differences between them remain unclear. Although several studies have assessed the accuracy and safety of FreeStyle Libre, which does not require calibration, research on FreeStyle Libre Pro remains limited.[10]

In this study, we aim to develop and validate a machine learning–based calibration framework for CSF glucose biosensors, enhancing their precision and reliability. Specifically, we employ a linear regression approach combined with interpolation techniques to align sensor readings with laboratory-measured glucose values. This approach builds on prior research demonstrating that statistical and machine learning models can significantly improve sensor accuracy by compensating for environmental and physiological variability.[11]

By integrating sensor-based glucose monitoring with machine learning–driven calibration, our study seeks to bridge the gap between conventional laboratory diagnostics and real-time biosensing technology. This advancement has the potential to improve bedside monitoring of CSF glucose levels, reduce the need for repeated lumbar punctures, and enhance patient outcomes in neurocritical care settings. We hypothesize that our calibrated biosensor model will demonstrate a significant reduction in measurement errors, improving agreement with laboratory values and making real-time CSF glucose monitoring a clinically viable alternative to traditional laboratory methods.


#

Materials and Methods

Experimental setup: A FreeStyle Libre sensor was attached to an adapter (in print). The adapter was attached with a three-way valve in the IV line, delivering controlled flow of glucose into the CGM sensor attached to a specially designed adapter.

Glucose concentrations preparation: Different concentrations of dextrose and sodium chloride (DNS) solutions were prepared at standardized levels of 50, 100, 150, 200, and 250 mg/dL in distilled water. Each concentration was administered on separate days in a decreasing order to assess sensor performance across varying glucose levels. A standard laboratory analyzer was used in parallel to obtain reference glucose measurements for calibration and validation of sensor accuracy.

Model development and calibration: To enhance sensor accuracy, a regression-based calibration model was developed to establish the measurement between sensor-derived glucose readings and reference laboratory values. The model was implemented in three key stages:

  1. Regression-based calibration: A linear regression model was trained to minimize discrepancies between the sensor and laboratory glucose readings.

  2. Interpolation for accuracy enhancement: The SciPy interp1d function was used to interpolate predicted glucose values between known data points, refining the sensor's accuracy.

  3. Real-time data acquisition: Glucose sensor values were retrieved using UART-based serial communication or Application Programming Interface (API) integration, allowing real-time data collection and processing.

Adaptive learning for continuous improvement: An adaptive learning mechanism was incorporated into the model to improve performance over time. The model was dynamically retrained after accumulating 10 new sensor–laboratory value pairs. This iterative process ensured continuous accuracy refinement, reducing deviations and optimizing glucose monitoring performance.


#

Results

The FreeStyle Libre sensor was evaluated against a standard laboratory analyzer for glucose monitoring across a range of concentrations (50–275 mg/dL; [Table 1]). Variations in sensor readings were observed at different glucose concentrations, with deviations between the sensor and laboratory analyzer values ([Fig. 1]). These variations reflect the inherent differences in sensor measurements that can be normalized with appropriate calibration.

Table 1

Results of the FreeStyle Libre sensor validation study

Day

Glucose concentration (mg/dL)

Sensor value (mg/dL)

Laboratory analyzer (mg/dL)

Deviation (%)

1

50

40

50

20

2

75

40

75

46.67

3

100

45

100

55

4

125

72

125

42.4

5

150

97

150

35.33

6

175

125

175

28.57

7

200

131

200

34.5

8

225

179

225

20.44

9

250

195

250

22

10

275

218

275

20.73

Zoom Image
Fig. 1 A scatter plot comparing sensor readings with laboratory values, showing deviations.

At a glucose concentration of 50 mg/dL, the sensor recorded 40 mg/dL, resulting in a 20% deviation. At a concentration of 75 mg/dL, the sensor value was 40 mg/dL, leading to a deviation of 46.67%. Similarly, at 100 mg/dL, the sensor recorded 45 mg/dL, showing a deviation of 55% ([Fig. 2]). As the glucose concentration increased, the sensor readings continued to show deviations, which progressively reduced at higher glucose levels.

Zoom Image
Fig. 2 Percentage deviation of sensor readings. A bar graph illustrating how sensor readings differ from laboratory values at different glucose concentrations.

At a glucose concentration of 125 mg/dL, the sensor recorded 72 mg/dL, resulting in a deviation of 42.4%. At a glucose concentration of 150 mg/dL, the sensor value was 97 mg/dL, yielding a deviation of 35.33%. These variations persisted through higher concentrations, with deviations of 28.57 and 34.5% as 175 and 200 mg/dL, respectively.

Further, next at a glucose concentrations of 225 and 250 mg/dL, the sensor recorded values of 179 and 195 mg/dL, respectively, resulting in deviations of 20.44 and 22%. Finally, at a glucose concentration of 275 mg/dL, the sensor recorded 218 mg/dL, leading to a deviation of 20.73%.

The overall mean absolute relative difference (MARD) across all concentrations was 30.45%. These deviations reflect variations in the sensor's response to different glucose concentrations, which need to be normalized through a calibration algorithm. After calibration, the MARD was reduced to 8.92%, demonstrating a substantial improvement in sensor accuracy.

SciPy's interp1d function enhanced the precision of predicted glucose values by interpolating between measured points, effectively reducing deviations from reference laboratory measurements. For instance, at a sensor reading of 40 mg/dL, the uncorrected value was approximately 50 mg/dL, reflecting a 20% deviation. After applying the calibration model, the corrected value was refined to 49.1 mg/dL, reducing the deviation to just 1.8%. Similarly, at a glucose concentration of 125 mg/dL, the sensor initially recorded 72 mg/dL, corresponding to a 42.4% deviation ([Fig. 3]). However, the interpolation method adjusted this to 123.5 mg/dL, minimizing the error to 1.2%. These results emphasize the effectiveness of interpolation in mitigating measurement fluctuations, thereby improving the overall accuracy and reliability of sensor-based glucose monitoring.

Zoom Image
Fig. 3 Calibration effectiveness. A line plot showing how the calibration model corrects sensor values, bringing them closer to laboratory values.

The model (https://github.com/Adilogan/Improvised-CSF-Model/blob/main/CSF_lab_improvised.py) was designed to integrate real-time glucose measurements using UART-based serial communication or API-based data retrieval, ensuring continuous data acquisition. To enhance accuracy over time, an adaptive retraining mechanism was implemented, which triggered a model update after accumulating 10 new sensor–laboratory value pairs. This dynamic approach led to progressive improvements in accuracy, as evidenced by a reduction in root mean square error (RMSE) from an initial 23.7 to 14.2 mg/dL after 10 updates and further down to 9.8 mg/dL after 30 updates. These results showed the model's ability to self-improve continuously and minimize deviations for glucose monitoring.


#

Discussion

Accurate CSF glucose measurement is critical for diagnosing and managing neurological conditions such as bacterial meningitis and ventriculitis. The current gold standard laboratory-based biochemical analysis via lumbar puncture provides precise measurements but is limited by delayed turnaround times and the need for invasive procedures.[12] [13] These limitations necessitate the development of real-time sensor-based monitoring solutions. While biosensors such as the FreeStyle Libre offer the advantage of immediate glucose readings, they often suffer from sensor drift, environmental variability, and interindividual physiological differences, leading to clinically significant inaccuracies.[14] [15] Previously reported deviations have been high between sensor-based and laboratory-measured glucose values.[7] To address these discrepancies, we developed a machine learning–based calibration framework that enhances the accuracy of real-time CSF glucose monitoring by aligning sensor readings with laboratory reference values.

A major challenge in sensor-based glucose monitoring is the systematic underestimation of glucose concentrations, particularly in lower ranges. This phenomenon has been consistently reported in CGM studies, where sensor readings are disproportionately lower than true values, potentially leading to misdiagnoses.[16] In our study, we observed that at a true glucose concentration of 100 mg/dL, the sensor recorded 45 mg/dL, representing a 55% deviation. Such large discrepancies emphasize the need for potent correction mechanisms. Our regression-based calibration model effectively addressed this issue by learning the relationship between sensor and laboratory values, reducing the overall MARD from 30.45 to 8.92%. These findings align with recent studies demonstrating that machine learning approaches can enhance biosensor accuracy by dynamically adapting to sensor variability and minimizing systematic bias.[17]

Beyond regression-based calibration, we incorporated interpolation techniques to further refine glucose predictions. SciPy's interp1d function was utilized to smooth transitions between measured data points, mitigating the nonlinear fluctuations commonly observed in biosensors. Prior research has shown that interpolation techniques significantly improve CGM performance by stabilizing fluctuations and enhancing trend accuracy.[18]

Our findings support this, as integrating interpolation with regression reduced the error margin from 42.4 to just 1.2% in the intermediate glucose range of 125 mg/dL. These results confirm that a hybrid approach, combining statistical models with interpolation, can substantially enhance biosensor reliability in real-time clinical applications.

By implementing an adaptive learning framework, our model improves accuracy. The results of this study demonstrated that iterative retraining progressively reduced the RMSE from 23.7 to 9.8 mg/dL, proving the model's ability to improve over time. Prior research has emphasized the importance of integrating machine learning–based correction mechanisms to compensate for sensor drift and physiological variability in real-time applications.[19] Our findings support this, showing that adaptive retraining keeps the sensor accurate without needing frequent recalibration.

Clinically, this approach improves bedside glucose monitoring, including the neurotrauma patents with external ventricular drain (EVD). Traditional CSF glucose testing requires multiple lumbar punctures, which are invasive and can cause complications such as infections. Our model provides real-time glucose values, reducing laboratory tests and making monitoring easier and safer for patients. Moreover, the integration of real-time biosensor data with an adaptive correction algorithm paves the way for future advancements, such as wearable or implantable biosensors for continuous CSF glucose monitoring. This would be a transformative development in managing neurotrauma conditions requiring intensive glucose surveillance, reducing dependence on recurrent invasive procedures.

Despite these promising results, some limitations remain. First, while linear regression combined with interpolation significantly improved sensor accuracy, it may not fully capture nonlinear fluctuations in glucose readings, particularly at extreme concentrations. Future studies should explore the use of neural networks or ensemble models to enhance predictive performance further. Additionally, our initial dataset, while demonstrating strong calibration outcomes, was relatively small. Expanding data collection across diverse patient populations and different sensor models will enhance the generalizability of our approach. Finally, real-time data processing introduces computational latency, which could impact usability in emergency settings.


#

Conclusion

This study validated the FreeStyle Libre sensor for glucose monitoring using an adapter-based in vitro setup, showing accurate results across various glucose concentrations. The sensor's performance was reliable and closely matched laboratory analyzer readings. Its potential to measure glucose in different media, like CSF, could be possible for clinical use. These findings pave the way for innovative applications in critical care and specialized settings. Further research is needed to confirm its effectiveness in real-world conditions.


#
#

Conflict of Interest

None declared.

  • References

  • 1 Johnston L, Wang G, Hu K, Qian C, Liu G. Advances in biosensors for continuous glucose monitoring towards wearables. Front Bioeng Biotechnol 2021; 9: 733810
  • 2 Cappon G, Vettoretti M, Sparacino G, Facchinetti A. Continuous glucose monitoring sensors for diabetes management: a review of technologies and applications. Diabetes Metab J 2019; 43 (04) 383-397
  • 3 Acciaroli G, Vettoretti M, Facchinetti A, Sparacino G. Calibration of minimally invasive continuous glucose monitoring sensors: state-of-the-art and current perspectives. Biosensors (Basel) 2018; 8 (01) 24
  • 4 Blum A. Freestyle Libre glucose monitoring system. Clin Diabetes 2018; 36 (02) 203-204
  • 5 Huang Q, Chen J, Zhao Y, Huang J, Liu H. Advancements in electrochemical glucose sensors. Talanta 2025; 281: 126897
  • 6 Pullano SA, Greco M, Bianco MG, Foti D, Brunetti A, Fiorillo AS. Glucose biosensors in clinical practice: principles, limits and perspectives of currently used devices. Theranostics 2022; 12 (02) 493-511
  • 7 Reddy N, Verma N, Dungan K. Monitoring technologies: continuous glucose monitoring, mobile technology, biomarkers of glycemic control. In: Feingold KR, Anawalt B, Blackman MR. et al., eds. Endotext. South Dartmouth, MA: MDText.com, Inc.; 2000
  • 8 Ida S, Goto H, Ida S. et al. Accuracy of a factory calibrated retrospective CGM device and the comparison to a conventionally calibrated retrospective CGM device: a pilot study. Biomed Sci 2019; 4 (04) 32-36
  • 9 Murata T, Sakane N, Hirota Y. et al. Difference in the accuracy of the third-generation algorithm and the first-generation algorithm of FreeStyle Libre continuous glucose monitoring device. J Med Invest 2024; 71 (3.4): 225-231
  • 10 Nakagawa Y, Hirota Y, Yamamoto A. et al. Accuracy of a professional continuous glucose monitoring device in individuals with type 2 diabetes mellitus. Kobe J Med Sci 2022; 68 (01) E5-E10
  • 11 Wang C, He T, Zhou H, Zhang Z, Lee C. Artificial intelligence enhanced sensors: enabling technologies to next-generation healthcare and biomedical platform. Bioelectron Med 2023; 9 (01) 17
  • 12 Hrishi AP, Sethuraman M. Cerebrospinal fluid (CSF) analysis and interpretation in neurocritical care for acute neurological conditions. Indian J Crit Care Med 2019; 23 (Suppl. 02) S115-S119
  • 13 Hatami-Fard G, Anastasova-Ivanova S. Advancements in cerebrospinal fluid biosensors: bridging the gap from early diagnosis to the detection of rare diseases. Sensors (Basel) 2024; 24 (11) 3294
  • 14 Fellinger E, Brandt T, Creutzburg J, Rommerskirchen T, Schmidt A. Analytical performance of the FreeStyle Libre 2 glucose sensor in healthy male adults. Sensors (Basel) 2024; 24 (17) 5769
  • 15 Freckmann G, Nichols JH, Hinzmann R. et al. Standardization process of continuous glucose monitoring: traceability and performance. Clin Chim Acta 2021; 515: 5-12
  • 16 Zhou J, Lv X, Mu Y. et al. The accuracy and efficacy of real-time continuous glucose monitoring sensor in Chinese diabetes patients: a multicenter study. Diabetes Technol Ther 2012; 14 (08) 710-718
  • 17 Nashruddin SNABM, Salleh FHM, Yunus RM, Zaman HB. Artificial intelligence-powered electrochemical sensor: recent advances, challenges, and prospects. Heliyon 2024; 10 (18) e37964
  • 18 Facchinetti A. Continuous glucose monitoring sensors: past, present and future algorithmic challenges. Sensors (Basel) 2016; 16 (12) E2093
  • 19 van Doorn WPTM, Foreman YD, Schaper NC. et al. Machine learning-based glucose prediction with use of continuous glucose and physical activity monitoring data: the Maastricht study. PLoS One 2021; 16 (06) e0253125

Address for correspondence

Deepak Agrawal, MBBS, MS, MCh
Department of Neurosurgery, All India Institute of Medical Sciences
New Delhi 110029
India   

Publication History

Article published online:
09 April 2025

© 2025. The Author(s). This is an open access article published by Thieme under the terms of the Creative Commons Attribution License, permitting unrestricted use, distribution, and reproduction so long as the original work is properly cited. (https://creativecommons.org/licenses/by/4.0/)

Thieme Medical and Scientific Publishers Pvt. Ltd.
A-12, 2nd Floor, Sector 2, Noida-201301 UP, India

  • References

  • 1 Johnston L, Wang G, Hu K, Qian C, Liu G. Advances in biosensors for continuous glucose monitoring towards wearables. Front Bioeng Biotechnol 2021; 9: 733810
  • 2 Cappon G, Vettoretti M, Sparacino G, Facchinetti A. Continuous glucose monitoring sensors for diabetes management: a review of technologies and applications. Diabetes Metab J 2019; 43 (04) 383-397
  • 3 Acciaroli G, Vettoretti M, Facchinetti A, Sparacino G. Calibration of minimally invasive continuous glucose monitoring sensors: state-of-the-art and current perspectives. Biosensors (Basel) 2018; 8 (01) 24
  • 4 Blum A. Freestyle Libre glucose monitoring system. Clin Diabetes 2018; 36 (02) 203-204
  • 5 Huang Q, Chen J, Zhao Y, Huang J, Liu H. Advancements in electrochemical glucose sensors. Talanta 2025; 281: 126897
  • 6 Pullano SA, Greco M, Bianco MG, Foti D, Brunetti A, Fiorillo AS. Glucose biosensors in clinical practice: principles, limits and perspectives of currently used devices. Theranostics 2022; 12 (02) 493-511
  • 7 Reddy N, Verma N, Dungan K. Monitoring technologies: continuous glucose monitoring, mobile technology, biomarkers of glycemic control. In: Feingold KR, Anawalt B, Blackman MR. et al., eds. Endotext. South Dartmouth, MA: MDText.com, Inc.; 2000
  • 8 Ida S, Goto H, Ida S. et al. Accuracy of a factory calibrated retrospective CGM device and the comparison to a conventionally calibrated retrospective CGM device: a pilot study. Biomed Sci 2019; 4 (04) 32-36
  • 9 Murata T, Sakane N, Hirota Y. et al. Difference in the accuracy of the third-generation algorithm and the first-generation algorithm of FreeStyle Libre continuous glucose monitoring device. J Med Invest 2024; 71 (3.4): 225-231
  • 10 Nakagawa Y, Hirota Y, Yamamoto A. et al. Accuracy of a professional continuous glucose monitoring device in individuals with type 2 diabetes mellitus. Kobe J Med Sci 2022; 68 (01) E5-E10
  • 11 Wang C, He T, Zhou H, Zhang Z, Lee C. Artificial intelligence enhanced sensors: enabling technologies to next-generation healthcare and biomedical platform. Bioelectron Med 2023; 9 (01) 17
  • 12 Hrishi AP, Sethuraman M. Cerebrospinal fluid (CSF) analysis and interpretation in neurocritical care for acute neurological conditions. Indian J Crit Care Med 2019; 23 (Suppl. 02) S115-S119
  • 13 Hatami-Fard G, Anastasova-Ivanova S. Advancements in cerebrospinal fluid biosensors: bridging the gap from early diagnosis to the detection of rare diseases. Sensors (Basel) 2024; 24 (11) 3294
  • 14 Fellinger E, Brandt T, Creutzburg J, Rommerskirchen T, Schmidt A. Analytical performance of the FreeStyle Libre 2 glucose sensor in healthy male adults. Sensors (Basel) 2024; 24 (17) 5769
  • 15 Freckmann G, Nichols JH, Hinzmann R. et al. Standardization process of continuous glucose monitoring: traceability and performance. Clin Chim Acta 2021; 515: 5-12
  • 16 Zhou J, Lv X, Mu Y. et al. The accuracy and efficacy of real-time continuous glucose monitoring sensor in Chinese diabetes patients: a multicenter study. Diabetes Technol Ther 2012; 14 (08) 710-718
  • 17 Nashruddin SNABM, Salleh FHM, Yunus RM, Zaman HB. Artificial intelligence-powered electrochemical sensor: recent advances, challenges, and prospects. Heliyon 2024; 10 (18) e37964
  • 18 Facchinetti A. Continuous glucose monitoring sensors: past, present and future algorithmic challenges. Sensors (Basel) 2016; 16 (12) E2093
  • 19 van Doorn WPTM, Foreman YD, Schaper NC. et al. Machine learning-based glucose prediction with use of continuous glucose and physical activity monitoring data: the Maastricht study. PLoS One 2021; 16 (06) e0253125

Zoom Image
Fig. 1 A scatter plot comparing sensor readings with laboratory values, showing deviations.
Zoom Image
Fig. 2 Percentage deviation of sensor readings. A bar graph illustrating how sensor readings differ from laboratory values at different glucose concentrations.
Zoom Image
Fig. 3 Calibration effectiveness. A line plot showing how the calibration model corrects sensor values, bringing them closer to laboratory values.