Arxiv:2204.03376V2 [Cs.Lg] 5 May 2023
Offline Reinforcement Learning for Safer Blood Glucose
Control In People With Type 1 Diabetes
Harry Emersona,∗, Matthew Guyb,, Ryan McConvillea,
Abstract
The widespread adoption of effective hybrid closed loop systems would rep- resent an important milestone of care for people living with type 1 diabetes (T1D). These devices typically utilise simple control algorithms to select the optimal insulin dose for maintaining blood glucose levels within a healthy range. Online reinforcement learning (RL) has been utilised as a method for further enhancing glucose control in these devices. Previous approaches have been shown to reduce patient risk and improve time spent in the tar- get range when compared to classical control algorithms, but are prone to instability in the learning process, often resulting in the selection of unsafe actions. This work presents an evaluation of offline RL for developing ef- fective dosing policies without the need for potentially dangerous patient interaction during training. This paper examines the utility of BCQ, CQL and TD3-BC in managing the blood glucose of the 30 virtual patients avail- able within the FDA-approved UVA/Padova glucose dynamics simulator.
When trained on less than a tenth of the total training samples required by online RL to achieve stable performance, this work shows that offline RL can significantly increase time in the healthy blood glucose range from 61.6±0.3% to 65.3±0.5% when compared to the strongest state-of-art base- line (p < 0.001). This is achieved without any associated increase in low blood glucose events.
May 8, 2023
common and challenging control scenarios such as incorrect bolus dosing, irregular meal timings and compression errors. The code for this work is available at: https://github.com/hemerson1/offline-glucose.
Keywords:
reinforcement learning, type 1 diabetes, glucose control,
1. Introduction
Type 1 diabetes (T1D) is an autoimmune disease characterised by an insufficiency of the hormone insulin, which is required for blood glucose reg- ulation. People with T1D must regularly monitor their blood glucose levels and estimate the correct dosage of insulin and carbohydrate intake to avoid dangerous instances of low and high blood glucose.
This Includes Taking
bolus insulin to account for ingested meal carbohydrates, in addition to ad- justing basal insulin to account for fluctuations between meals. Hybrid closed loop systems provide an opportunity for people with T1D to automatically regulate their basal insulin dosing [1, 2, 3]. These devices consist of an in- sulin pump connected to a continuous glucose monitor (CGM) by a control algorithm. The CGM measures the blood glucose level of the user and the control algorithm uses the CGM data to instruct the insulin pump to deliver the required dosage. This process repeats at regular intervals and corrects for deviations in blood glucose from some target blood glucose range or value.
Trials of these devices in adults and pediatrics have shown a significant as- sociation between the use of hybrid closed loop systems and improvements to time spent in the recommended blood glucose range [4, 5, 6]. Hartnell et al. provides a detailed overview of existing closed loop devices and their functionality .
The majority of commercially available hybrid closed loop systems utilise predictive integral derivative (PID) controllers or model predictive controllers (MPC) . These algorithms are robust and easily interpretable, but limit the efficacy of the devices. PID algorithms are prone to overestimating in- sulin doses following meals and are unable to easily incorporate additional factors which affect blood glucose, such as insulin activity, time of day and exercise [9, 10]. In contrast, MPCs typically utilise linear or simplified mod- els of glucose dynamics, which are unable to capture the full complexity of the task [11, 12]. Reinforcement learning (RL) has been proposed as a means of addressing this problem; through which a decision-making agent
2
learns the optimal sequence of actions to take in order to maximise some concept of reward. In glucose control, RL algorithms have demonstrated an ability to learn sophisticated and personalised control policies for individual patients. These policies often outperform their PID and MPC counterparts when trained and evaluated in simulators of glucose dynamics, but are im- practical for clinical use in their present state [13, 14, 15]. Current approaches predominantly utilise online RL algorithms, which require interaction with a patient or simulator during training to develop control policies and learn via a process akin to trial and error. These agents typically start with a poor un- derstanding of their environment and are prone to learning instability [16, 17], both of which could feasibly contribute to the selection of dangerous insulin doses. This facet of online RL limits its utility in real-world hybrid closed loop systems; highlighting the necessity for methods capable of learning ac- curate dosing policies from clinically obtainable quantities of glucose data without the associated risk.
This work presents a proof-of-concept in silico study on the use of offline RL for glucose control, in which an RL agent learns without environmen- tal interaction during training and instead learns from a static dataset of demonstrations collected under another agent. This entails a rigorous anal- ysis of the offline RL algorithms: batch constrained deep Q-learning (BCQ) , conservative Q-learning (CQL) and twin delayed deep deterministic policy gradient with behavioural cloning (TD3-BC) in their ability to develop safe and high performing insulin dosing strategies in hybrid closed loop systems. The presented algorithms are trained and tested across a co- hort of 30 virtual patients (10 children, 10 adolescents and 10 adults) and their performance and sample-efficiency is scrutinised with respect to the cur- rent strongest online RL and control baselines. Practical limitations such as missing CGM data and suboptimally set PID parameters are also explored, as these are common features of real-world blood glucose data. To ensure the reliable and effective operation of offline RL in the worst-case scenarios, safety is scrutinised across a range of realistic and common control events.
This includes overdosing in mealtime insulin, sporadic and irregular meal events and erroneous compression lows caused by force on the CGM inser- tion site. This work shows that offline RL can yield more effective and safer insulin dosing policies without the patient interaction required by prior RL approaches. Furthermore, this method also utilises significantly smaller sam- ples of data making it more applicable for use in real patients. The presented results provide a foundational overview of the advantages and limitations of
3
using offline RL in glucose control tasks and will provide a reference for fu- ture research seeking to integrate offline RL in hybrid closed loop systems before trialling on real-world patients in a controlled setting.
2. Related Work
Offline RL is an area of increasing interest in healthcare due to the safety concerns associated with incorrect decision-making . Previous healthcare research has focused on developing lung cancer protocols from samples of historical data , identifying optimal recommendations for sepsis treatment and facilitating RL policy evaluation in an offline medical setting .
Despite the prevalence of offline RL in other domains of medicine, its use in glucose control has been limited . Javad et al. used a q-learning algo- rithm trained offline on samples of clinical data to select the optimal daily basal dose for patients of a given demographic . Shi et al. presented an offline q-learning approach trained on the OhioT1DM dataset for selecting discrete doses of basal insulin at hourly intervals . Similarly, Li et al. used a model-based RL algorithm to learn the blood glucose dynamics of patients recovering from diabetic ketoacidosis . This learned model was then used to train an online q-learning algorithm to select the optimal basal dose at three hour intervals over a 24-hour period. Although these approaches pre- sented methods for learning dosing policies offline, the timeframe over which they act would be insufficient for managing the short-term blood glucose fluc- tuations associated with meals and exercise. The most significant application of offline RL for hybrid closed loop systems was presented in Fox, in which the methods BCQ and bootstrapping error accumulation reduction (BEAR) were compared to online RL approaches trained on an imperfect simulator of a single adult patient . Analysis showed that although offline RL was capable of developing competent control policies, the achieved performance was less than that obtained using an online approach trained on an imperfect simulator.
Blood glucose forecasting is an integral aspect of T1D management , consequently significant research has been focused on extending established control algorithms using blood glucose prediction models dervied via super- vised learning. This has included using quantile regression to predict upper and lower bounds on future blood glucose values , bolstering fuzzy logic controllers with neural network prediction and leveraging a pair neural networks to forecast blood glucose and select insulin doses based on the pre-
4
dictions . A number of these approaches have also been experimentally validated within animal trials [34, 35]. Of particular note, Chen et al. trains a behavioural cloning agent on the insulin doses of an MPC demonstrator; providing a sample-efficient alternative of learning insulin dosing strategies without the risk of dangerous action selection during training. Supervised learning has also been used in hybrid closed loop systems for functions sec- ondary to insulin dosing, such as hypoglycemia prediction and detecting unreported carbohydrate consumption .
Within online RL, several attempts have been made to address concerns around safety and learning instability in glucose control. Fox et al. employed a transfer learning approach to develop dosing policies from a general patient population before fine-tuning them on target patients . Lim et al. used a PID controller to guide an online RL algorithm in the early stages of its learning; progressively introducing a greater proportion of RL agent actions . Zhu et al. developed an online RL algorithm capable of integration with a dual hormone pump, allowing control of both insulin and glucagon dosing and hence for low blood glucose corrections to be made through glucagon in- fusion . These approaches all showed comparable or reduced time spent in the potentially dangerous low blood glucose range when contrasted with MPC and PID algorithms, but are limited by their reliance on glucose dy- namics simulators. These simulators represent a simplification of true blood glucose dynamics; with almost all unable to incorporate common events such as exercise, stress and illness. In moving towards use in real-world hybrid closed loop systems, online RL performance is likely to deteriorate as la- tent variables start to influence the environment . In addition, glucose dynamics simulators allow for unlimited training data generation. Of the ap- proaches highlighted which explicitly stated their sample size, the algorithms used 7,000 days (>19 years) and 1,530 days (>4 years) of simulated data to develop personalised dosing policies. In an in vivo setting, allowing an RL algorithm to control a patient’s blood glucose for several years without any associated guarantee of safety would be unethical.
This work represents the first rigorous evaluation of offline RL for glucose control; contrasting the performance of a diverse range of state-of-the-art algorithms in a comprehensive cohort of virtual patients. Evaluation is per- formed for a combined 41,660 virtual days (>114 years) and the presented algorithms are evaluated inline with the current clinical guidance for assessing patient glucose control. This analysis holds a particular focus on exploring the practical and safety limitations of offline RL within hybrid closed loop
5
systems. In silico evaluation of this nature is essential in justifying trials of offline RL for glucose control in real patient populations.
3.1. Problem Formulation
The task of glucose control in hybrid closed loop systems can be modelled as a partially observable Markov decision process (POMDP) described by (S, A, Ω, T , R, O). In each timestep t, the agent in a single state s ∈S, describing the current environment, interacts with the environment via an action a ∈A and receives a reward r = R(s) ∈R specifying the optimality of the action, before transitioning into a new state s′ ∈S with transition probability P(s′|s, a) = T (s, a, s′).
In A Pomdp, The Agent Is Unable To
directly view the next state s′ ∈S, and instead receives an observation o ∈Ωdetermined by probability P(o′|s′, a) = O(o′, s′, a) which provides insight into the next state . In the glucose control setting, the state and action are defined by the patient blood glucose value gt and by the basal insulin dose it in that timestep. The partial observability of the state results from the inherent noise in the CGM devices used to make blood glucose measurements and the dependency of blood glucose values on historical data, such as ingested carbohydrates ct, bolus doses bt and previous blood glucose values . Contextual information was incorporated in this work by utilising
The Following State:
st = [gt, gt−1, gt−2, ..., gt−8, It, Mt].
(1)
This representation consists of a rolling window of measured blood glucose values updated every three minutes using the past four hours of blood glucose data spaced at 30-minute intervals, with gt being the blood glucose in the current timestep and and gt−8 being the blood glucose four hours prior. An estimation of the combined insulin activity of basal and bolus insulin (insulin- on-board) It and an estimation of carbohydrate activity Mt are also included
6
where N represents the number of prior timesteps the algorithm considers in its decision-making. This representation simplifies true insulin and carbohy- drate activity by assuming that they decay linearly to zero over a four hour period. This state was selected in place of the full sequence of blood glucose, carbohydrate and insulin data utilised in other approaches to reduce state dimensionality and to avoid modifying the offline RL methods to incorporate recurrency [15, 14, 39]. The reward for the agent was given by the negative of the Magni risk function, which models the clinical risk for a given blood glucose value . An additional penalty of -1e5 was added for blood glu- cose values beyond the physiologically feasible range of 10 to 1,000 mg/dl.
This modification is several orders of magnitude larger than the obtainable reward under the Magni risk function and was included as an incentive for the agent to not purposefully terminate the environment and avoid future negative reward. The parameters for the risk function are given as follows