scieee AI-readable full text Open interactive document viewer

Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients

Pallarès López, Roger,Aguirre, Aaron

Full text

Master’s Thesis Double Master's Degree in Industrial Engineering and Automatic Control and Robotics Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients DISERTATION Author: Roger Pallarès López Director: Nicholas Houstis, MD, PhD Coadvisor: Aaron Aguirre, MD, PhD Speaker: Cecilio Angulo Bahon, PhD Call: April 2021 Escola Tècnica Superior d’Enginyeria Industrial de Barcelona Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 1 ABSTRACT Treating patients with cardiogenic shock is definitely a medical challenge. Physicians in the cardiac intensive care unit have to constantly face a stressful environment where they have to make quick decisions on a vast amount of patients. They must reason about the complex physiology of critical illness and take actions based on a mental model of the patient’s physiology, together with mental predictions of possible patient’s outcomes to interventions. This approach is clearly life-saving and irreplaceable, yet it can lead to errors and compromise patient results. A computational tool equipped with quantitative knowledge of physiology with the ability to systematically evaluate the patient’s state, could help physicians with valuable suggestions for action. In this master’s thesis it has been proposed to train a policy with reinforcement learning to make therapy decisions on simulated patients with cardiogenic shock due to decompensated heart failure. The Burkhoff and Tyberg cardiovascular hemodynamics model was implemented to simulate cardiogenic shock patients. The deep Q-network with experience replay algorithm was developed to train policies interacting with the simulator. Improvements on the policy performance were carried out by introducing the domain randomization technique during the training phase. Such a technique demands a set of parameter ranges to define the domain. Therefore, these parameter ranges were obtained from real patient’s data by means of a system identification tool. Results showed that using an encoder to identify parameters from patient’s data can be promising, yet improvements are needed. Furthermore, it was demonstrated that domain randomization increases robustness on policies, giving their ability to operate in unseen environments. The variation of penalty terms on the reward showed different behaviors on the trained policies, suggesting the need for such penalties to obtain the desired policy performance. Overall, a policy was trained and tested satisfactorily on a simulated patient with cardiogenic shock. These findings suggested that a policy can learn from simulated data and propose therapy decisions that in some cases could resemble to the actions made by physicians. The outcomes obtained from this approach are encouraging and further analysis and assessment on policies with real data should be performed. Page 2 Master’s Thesis - Roger Pallar`es L´opez Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 3 CONTENTS ABSTRACT ............................................ 1 CONTENTS ............................................ 3 LIST OF FIGURES ....................................... 5 LIST OF TABLES ........................................ 9 1 INTRODUCTION ...................................... 11 1.1 Motivation ......................................... 11 1.2 Projectscope ........................................ 12 1.3 Projectobjectives...................................... 13 2 BACKGROUND AND STATE OF THE ART ..................... 15 2.1 The Cardiovascular System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.1.1 The Heart and Circulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.1.2 Decompensated Heart Failure . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.1.3 TailoredTherapy.................................. 20 2.2 Cardiovascular System Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.2.1 Multiscale Modeling Approaches . . . . . . . . . . . . . . . . . . . . . . . . . 21 2.2.2 Cardiovascular Hemodynamics Modeling Approaches . . . . . . . . . . . . . . 22 2.3 MachineLearning...................................... 23 2.3.1 Artificial Neural Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 2.3.2 Reinforcement Learning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 2.4 Reinforcement Learning in Healthcare . . . . . . . . . . . . . . . . . . . . . . . . . . 26 3 MATERIALS AND METHODS .............................. 27 3.1 ClinicalDataAcquisition ................................. 27 3.1.1 Massachusetts General Hospital Databases . . . . . . . . . . . . . . . . . . . 27 3.1.2 DataCuration ................................... 28 3.1.3 CohortofPatients ................................. 29 3.1.4 Preprocessing and Final Dataset . . . . . . . . . . . . . . . . . . . . . . . . . 31 3.2 Cardiovascular Hemodynamics Model . . . . . . . . . . . . . . . . . . . . . . . . . . 32 3.2.1 ModelParameters ................................. 33 3.2.2 ModelEquations.................................. 35 Page 4 Master’s Thesis - Roger Pallar`es L´opez 3.2.3 Model Implementation and Assessment . . . . . . . . . . . . . . . . . . . . . 37 3.3 Reinforcement Learning Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 3.3.1 Deep Q-Network Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 3.3.2 Reinforcement Learning for Cardiogenic Shock . . . . . . . . . . . . . . . . . 40 3.3.3 Policy Transfer to Real World . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 3.3.4 Reinforcement Learning Implementation and Assessment . . . . . . . . . . . 44 3.4 System Identification for Parameter Estimation . . . . . . . . . . . . . . . . . . . . . 47 3.4.1 Modification of Autoencoder for System Identification . . . . . . . . . . . . . 47 3.4.2 System Identification Implementation and Assessment . . . . . . . . . . . . . 48 4 RESULTS AND DISCUSSION .............................. 53 4.1 Cardiovascular Simulation with Burkhoff and Tyberg Model . . . . . . . . . . . . . . 53 4.1.1 Analysis of Simulated Patients . . . . . . . . . . . . . . . . . . . . . . . . . . 53 4.1.2 Comparison with Real Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 4.2 SystemIdentification.................................... 56 4.2.1 DecoderTraining.................................. 56 4.2.2 Encoder Training and Cardiovascular Parameter Estimation . . . . . . . . . . 58 4.3 Reinforcement Learning for Cardiogenic Shock Patients . . . . . . . . . . . . . . . . 63 4.3.1 Assessment of Domain Randomization Robustness . . . . . . . . . . . . . . . 63 4.3.2 Comparison of Restricted Policies . . . . . . . . . . . . . . . . . . . . . . . . . 65 4.3.3 Importance of Penalty Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 4.3.4 Final Policy Assessment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 5 PROJECT IMPACT AND PLANNING ........................ 75 5.1 EnvironmentalImpact................................... 75 5.2 SocialImpact........................................ 75 5.3 ProjectTimeline ...................................... 76 5.4 Project Management Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 5.5 ProjectCosts........................................ 78 CONCLUSIONS .......................................... 83 ACKNOWLEDGMENTS .................................... 85 REFERENCES .......................................... 87 Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 5 LIST OF FIGURES 2.1 Schematic diagram of the heart with the four chambers and valves. Extracted from [12]. 16 2.2 Illustrations of the circulatory system. a) Schematic diagram, showing both the systemic and pulmonary circulations, the heart and the distribution of blood volume. Extracted from [12]. b) Illustration of human circulation with some vital organs. Red lines are blood rich in O2and the blue lines blood that contains more CO2. Extracted from[8]. . 17 2.3 The four phases of the cardiac cycle. From top and clockwise: filling, isovolumetric contraction, ejection and isovolumetric filling. Adapted from [8]. . . . . . . . . . . . . . 18 2.4 Example of a left ventricle pressure volume loop (PV loop). Adapted from. [8] . . . . . 19 2.5 PV loops showing the effect of the heart’s loading conditions and inotropic state. Extracted from [15]. a) Effect of preload related to SV . b) Effect of afterload related to both SV and pressure. c) Effect of inotropy related to SV . ................ 20 2.6 Multiscale modeling. From bottom to the top: cell scale modeling, tissue/fiber scale modeling, organ (cardiac electrical and mechanical) modeling and finally whole body modeling.Adaptedfrom[35]. ................................ 21 2.7 Schema of a simple artificial neural network. Input nodes are denoted with x, hidden nodes with hand output node with y. Adapted from [7]. . . . . . . . . . . . . . . . . . 23 2.8 Reinforcement learning framework agent-environment. Extracted from [30]. . . . . . . 24 3.1 Data workflow. From ICU patient to EDW and Bedmaster databases. Framed in red bothEDWandBMdatabases. ............................... 27 3.2 Data workflow. From EDW and Bedmaster databases to HD5 files. . . . . . . . . . . . 29 3.3 Cohort reduction due to signal missingness and outlier removal. . . . . . . . . . . . . . 30 3.4 Diagrams of the Burkhoff and Tyberg model. a) Six compartment model (parameters explained in Section 3.2.1). RV and LV stand for right and left ventricles, respectively. Extracted from [1]. b) Equivalent electrical circuit of the CV model (parameters explained in Section 3.2.1). RV and LV stand for right and left ventricles, respectively. SA and SV, systemic arteries and veins, respectively. PA and PV, pulmonic arteries and veins, respectively. MV, AoV, TV and PV, mitral, aortic, tricuspid and pulmonar valves, respectively. Adapted from [26]. . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 3.5 Shape of the reward function related to cardiac output. . . . . . . . . . . . . . . . . . . 42 3.6 Shape of penalty terms. a) Drug action penalty term (R− dp(s, a)). b) Power penalty term (R− pp(s, a)). ........................................... 43 3.7 Schematic workflow of the RL framework to train policies in simulated CS patients. . . 45 3.8 Schematic representation of an autoencoder architecture. . . . . . . . . . . . . . . . . . 48 Page 6 Master’s Thesis - Roger Pallar`es L´opez 3.9 Process followed to obtain the system identification tool. Step 1: train the decoder with simulated data. Step 2: train the encoder with the whole autoencoder architecture using both simulated and real patient data. Step 3: estimate the 9 CV parameters from the CABGdataset. ........................................ 49 3.10 NN architectures of both encoder and decoder. Each box represents a layer. Between parenthesis are presented the number of neurons and the activation function. . . . . . . 50 4.1 Left ventricle pressure-volume loop. a) Healthy subject with baseline parameters. b) Subject with cardiomyopathy represented by a reduction of the left ventricle end-systolic elastance (EesLV = 1mmHg/mL). .............................. 54 4.2 Simulated arterial pressure (Pa,s). a) Healthy subject with baseline parameters. b) Subject with cardiomyopathy represented by a reduction of the left ventricle end-systolic elastance (EesLV = 1mmHg/mL). .............................. 54 4.3 Comparison of real and simulated arterial pressure (Pa,s). a) Real arterial pressure from one CABG cohort patient. b) Simulated arterial pressure. . . . . . . . . . . . . . . . . 55 4.4 Decoder training curves. a) Loss evolution of training (blue) and validation (orange) sets. b) Accuracy evolution of validation set. . . . . . . . . . . . . . . . . . . . . . . . . 57 4.5 Comparison of generated pressure waves from simulator (blue) and decoder (orange). Baseline parameters used. a) Arterial pressure (Pa,s). b) Central venous pressure (Pv,s). c) Pulmonary artery pressure (Pa,p). ............................ 57 4.6 Encoder training curves with real data. a) Loss evolution of training (blue) and validation (orange) sets. b) Accuracy evolution of validation set. . . . . . . . . . . . . . . . . . . . 59 4.7 Comparison of generated pressure waves from simulator (blue) and autoencoder (orange). Baseline parameters used. a) Arterial pressure (Pa,s). b) Central venous pressure (Pv,s). c) Pulmonary artery pressure (Pa,p). ............................ 60 4.8 Estimated CV parameters from CABG cohort (n = 776341) employing the encoder. From left to right and top to bottom: Right ventricular end-systolic elastance (Ees rv); Left ventricular end-systolic elastance (Ees lv); Pulmonic arterial resistance (Ra pul); Systemic arterial resistance (Ra sys); Pulmonic arterial compliance (Ca pul); Systemic arterial compliance (Ca sys); Pulmonic venous compliance (Cv pul); Systemic venous compliance (Cv sys); Stressed volume (Vs). . . . . . . . . . . . . . . . . . . . . . . . . . 61 4.9 Policy training curves with reward per episode (blue), averaged reward over 10 episodes (orange) and training horizon (dashed black). a) Policy trained without domain randomization (DR). b) Policy trained with domain randomization (DR). . . . . . . . . . 63 4.10 Policy performance from training initial conditions without domain randomization (baseline parameters with low LV end-systolic elastance (EesLV = 1mmHg/mL)). Comparison of policies trained without (blue) and with (orange) DR. a) Cardiac output (CO). b) Mean arterial pressure ( ¯ Pa,s). ............................... 64 Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 7 4.11 Policy performance from initial conditions not used during training (baseline parameters with low LV end-systolic elastance (EesLV = 0.6mmHg/mL) and high systemic venous resistance (Rv,s = 0.06mmHg ·s/mL)). Comparison of policies trained without (blue) and with (orange) DR. a) Cardiac output (CO). b) Mean arterial pressure ( ¯ Pa,s). . . . 65 4.12 Policy training curves with mean (line) ±standard deviation (shaded region) of averaged reward over 10 episodes. 5 policies trained for each case: policy without stressed volume (Vs) actions (blue), policy without heart rate (HR) actions (orange), and policy without end-systolic elastance (Ees) actions (red). Horizon represented with black dashed line. 66 4.13 Policy performance from the three restricted policies. Initial conditions: baseline parameters with low LV end-systolic elastance (EesLV = 0.8mmHg/mL) and high systemic venous resistance (Rv,s = 0.04mmHg ·s/mL). Comparison of policies trained without stressed volume (Vs) actions (blue), without heart rate (HR) actions (orange), and without end-systolic elastance (Ees) actions (red). a) Cardiac output (CO). b) Mean arterial pressure ( ¯ Pa,s). ........................................ 66 4.14 Actions from the three restricted policies. a) Policy without stressed volume (Vs) actions. b) Policy without heart rate (HR) actions. c) Policy without end-systolic elastance (Ees) actions. ............................................. 67 4.15 Policy training curves with mean (line) ±standard deviation (shaded region) of averaged reward over 10 episodes. 5 policies trained for each case: policy without penalty terms (blue), policy with only power penalty term (orange), and policy with both drug and power penalty terms (red). Horizon represented with black dashed line. . . . . . . . . . 68 4.16 Policy performance from the three policies with different penalty terms. Initial conditions: baseline parameters with low LV end-systolic elastance (EesLV = 0.8mmHg/mL) and high systemic venous resistance (Rv,s = 0.04mmHg ·s/mL). Comparison of policies trained without penalty terms (blue), with only power penalty term (orange), and with both drug and power penalty terms (red). a) Cardiac output (CO). b) Mean arterial pressure ( ¯ Pa,s). ........................................ 69 4.17 Cardiac power output (CPO) comparison from the three policies: without penalty terms (blue), with only power penalty term (orange), and with both drug and power penalty terms(red). .......................................... 70 4.18 Actions from policies with power and with both penalty terms. a) Policy without penalty terms. b) Policy with both power and drug penalty terms. . . . . . . . . . . . . . . . . 70 4.19 Final policy performance with disturbances. Initial conditions: baseline parameters with low LV end-systolic elastance (EesLV = 0.8mmHg/mL) and high systemic venous resistance (Rv,s = 0.03mmHg·s/mL). First disturbance at 40 policy steps: sudden reduction of LV end-systolic elastance (EesLV = 1.0mmHg/mL) and increment of systemic venous resistance (Rv,s = 0.05mmHg ·s/mL). Second disturbance at 80 policy steps: sudden reduction of systemic venous resistance to its healthy value (Rv,s = 0.015mmHg·s/mL). a) Cardiac output (CO). b) Mean arterial pressure ( ¯ Pa,s). ................ 71 Page 14 Master’s Thesis - Roger Pallar`es L´opez Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 15 2. BACKGROUND AND STATE OF THE ART Theoretical background related to the project is explained and presented in this chapter. Furthermore, this information is complemented with examples from published works, with a section specifically dedicated to reinforcement learning applied to the healthcare field (Section 2.4). 2.1. The Cardiovascular System Basic physiological concepts that appear throughout this thesis are explained in this section. Moreover, decompensated heart failure and tailored therapy are introduced and described in more detail. 2.1.1. The Heart and Circulation The cardiovascular system consists of the heart, which is a muscular pump, and a closed system of vessels called arteries, veins, and capillaries. It has four main functions, as explained below:  The main function is the rapid convective transport of O2, glucose, aminoacids and other components to the tissues, and the rapid washout of metabolic waste, such as CO2or urea.  Another function is that acts as a control system. It distributes hormones to the tissues and secretes bioactive agents itself.  Moreover, the cardiovascular system is essential for the regulation of body temperature, bringing heat from deep organs to the skin.  Finally, in reproduction, it is also responsible of the hydraulic mechanism for genital erection. The heart is a muscular organ about the size of a fist and it is the most complex component of the cardiovascular system. Its function is to pump the blood and circulate it through the vascular system. It is formed by four distinct chambers: the right atrium, the right ventricle, the left atrium and the left ventricle. The right atrium receives blood from the superior and inferior vena cava, which through the tricuspid valve, ejects that blood into the right ventricle. The right ventricle is in charge of ejecting the received blood to the pulmonary artery, which passes the pulmonary valve. On the left side of the heart, the left atrium receives blood from the pulmonary veins and transmit it to the left ventricle through the mitral valve. Finally, the left ventricle ejects blood to the aorta, through the aortic valve. In Figure 2.1, a simplified illustration of the heart is shown. Page 16 Master’s Thesis - Roger Pallar`es L´opez Figure 2.1 Schematic diagram of the heart with the four chambers and valves. Extracted from [12]. In addition to the heart, a vascular system is needed to deliver oxygenated blood to tissues and transport waste products to removal centers such as the lungs, liver, and kidneys. This circulatory system forms a closed loop for the blood flow. The left heart receives blood rich in O2from the lungs and pumps this blood into the systemic arteries. The systemic arteries, beginning with the aorta, branch out to smaller arteries that finally become the capillaries, where the exchange of O2 and CO2takes place. Leaving the systemic capillaries, the blood enters the systemic veins, through which it flows in vessels that progressively augment their size to the vena cava. Then, the right heart pumps blood into the pulmonary arteries that distribute the blood to the lungs. The smallest branches of these arteries are the pulmonary capillaries, where CO2leaves and O2enters the blood. Finally, the oxygenated blood leaves the pulmonary capillaries and enters the pulmonary veins, through which it flows back to the left heart. A red blood cell takes approximately one minute to complete this circuit in an individual at rest. The circulation described above is illustrated in Figures 2.2a and 2.2b. In Figure 2.2a the distribution of blood volume over the circuit is shown. Note that most of the volume is gathered in the systemic veins. On the other hand, in Figure 2.2b, a more illustrative circulatory system is shown, where the most important vital organs are presented. Note that vessels colored red carry blood rich in O2and vessels in blue carry blood depleted of O2and enriched in CO2. Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 17 (a) (b) Figure 2.2 Illustrations of the circulatory system. a) Schematic diagram, showing both the systemic and pulmonary circulations, the heart and the distribution of blood volume. Extracted from [12]. b) Illustration of human circulation with some vital organs. Red lines are blood rich in O2and the blue lines blood that contains more CO2. Extracted from[8]. In addition to its topology, the function of the cardiovascular system is characterized by a set of physiologic variables. Since the blood is nearly incompressible, the volume (V) is a convenient measure of its quantity. In general, blood volume is measured in milliliters [mL]. Moreover, its time derivative is another key variable: the blood flow (Q), usually measured in liters per minute [L/min]. Also, the pressure (P) is used to describe the blood inside vessels, which in general is measured in millimeters of mercury [mmHg]. The total blood flow generated by the heart, termed the cardiac output (CO) and measured in liters per minute [L/min], is especially important as it determines the rate of oxygen delivery to tissues. It is decomposed further into two cardiac state variables, heart rate and stroke volume. Heart rate (HR) refers to the number of muscle contractions the heart completes per minute, measured in beats per minute [bpm]. Stroke volume (SV ) refers to the volume of blood ejected with each beat. Page 18 Master’s Thesis - Roger Pallar`es L´opez Hence, cardiac output can be quantified as the product of these variables: CO =SV ×HR (2.1) Additional relations exist between the physical variables defined above. Blood vessels are considered to have a resistance to blood flow, and a compliance in response to distending pressure. The simplest models of these relationships are linear [9]: Q=∆P R(2.2) V=CP (2.3) where Ris known as the resistance of the vessel, in general measured in [mmHg ·s/mL]; and Cis the compliance of the vessel, usually measured in [mL/mmHg]. The heart generates flow by repeatedly ejecting blood in a characteristic “cardiac cycle”. Each cycle (heart beat) consists of a contraction (systole) and a relaxation (diastole) that results in the ejection of a quantity of blood, the previously defined stroke volume (SV ). The entire cycle is divided into four phases, based on the position of the heart valves: ventricular filling, isovolumetric contraction, ejection and isovolumetric relaxation. Figure 2.3 The four phases of the cardiac cycle. From top and clockwise: filling, isovolumetric contraction, ejection and isovolumetric filling. Adapted from [8]. In ventricular filling, both tricuspid and mitral valves are open, and pulmonary and aortic valves are closed. The heart is relaxed and filled with blood. It is usually the longest phase of the cycle, taking two thirds of it. In isovolumetric contraction, all four valves are closed. The heart starts contracting Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 19 and because of ventricles have temporarily become a closed chamber, pressure of blood rises quickly. During ejection, mitral and tricuspid valves are closed, and pulmonary and aortic valves are open. The heart is contracted and blood is ejected to the arteries. Finally, in isovolumetric relaxation, again all four valves are closed. Heart relaxes and since it is again a closed chamber, pressure drops rapidly. The explained cycle can be appreciated in Figure 2.3, in which the four phases are depicted. The state of a cardiac chamber during the cardiac cycle, e.g. the left ventricle, can be represented by the so called PV loop. This loop expresses the chamber’s state in terms of its volume and pressure as a function of time. It is very useful for discussing the heart performance in a quantitative manner. Moving counter-clockwise, the four phases can be appreciated. Figure 2.4 shows an example of PV loop of a subject resting. For example, the stroke volume (SV ) can be determined, since it is defined as the end-diastolic minus the end-systolic volumes. Figure 2.4 Example of a left ventricle pressure volume loop (PV loop). Adapted from. [8] 2.1.2. Decompensated Heart Failure Heart failure can be defined as the inability of the heart to pump sufficient blood to meet the body’s full range of demands and/or to do so at abnormally high pressure. Decompensated heart failure (DHF) is a more advanced form when O2delivery by the heart no longer meets the body’s minimum demands and requires immediate therapeutic intervention. As presented in the introduction (Section 1.1), costs in healthcare for DHF reach approximately 60% of the total costs related to the treatment of heart failure. It is estimated that its prevalence is around 10 % in the population over 70 years of age. Moreover, mortality rate among patients discharged during the first 90 days is approximately of 10%, with about 25% of readmission in this period [19]. Page 20 Master’s Thesis - Roger Pallar`es L´opez The most severe form of DHF is cardiogenic shock (CS). In CS O2delivery by the heart is so impaired that rapid organ damage occurs, in particular those organs with higher O2demands such as the kidneys and brain. As a result CS is rapidly fatal. The treatment strategy for CS should be carefully guided by patient’s vital signs, physical examination, laboratory tests, echocardiography, etc. in order to reverse the decompensated state [14]. Tailored therapy [29] is a clinical algorithm that follows this strategy. 2.1.3. Tailored Therapy As presented Section 2.1.2, tailored therapy is a clinical algorithm that uses patient’s physiology data to choose treatments that reverse the decompensated state avoiding CS. The goal is to restore O2 transport by restoring the heart’s normal loading conditions (preload and afterload) and inotropic state. This is achieved by dosing vasoactive medications and using artificial mechanical support. However, what are the heart’s loading conditions and inotropic state? Preload, also known as the left ventricular end-diastolic pressure (LVEDP), is the amount of ventricular stretch at the end of diastole. It directly affects the ventricular filling of the heart. Therefore, a high preload is related with increased stroke volume (SV ), and vice versa, a low preload results in a lower SV . Afterload is the condition that affects the amount of resistance that the heart must overcome to open the aortic valve and eject the blood volume into the aorta. It is both related to the aortic pressure and the SV . Thereby, an increased afterload results in a high resistance and thus, a lower stroke volume and higher pressures. If the afterload is low, the opposite happens. Finally, inotropy is the heart state related to the heart’s force of contraction and its elastance. It is mainly linked to the SV , and an increment of inotropy causes a reduction of the end-systolic volume and thus a higher SV [15]. Left ventricular pressure volume (PV) loops mentioned in Section 2.1.1 are a very useful tool for visualizing such effects mentioned in the previous paragraph. In Figure 2.5, both preload and afterload as well as inotropy effects are schematized. (a) (b) (c) Figure 2.5 PV loops showing the effect of the heart’s loading conditions and inotropic state. Extracted from [15]. a) Effect of preload related to SV . b) Effect of afterload related to both SV and pressure. c) Effect of inotropy related to SV . Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 21 2.2. Cardiovascular System Modeling A cardiovascular (CV) system model is a mathematical abstraction of cardiovascular physiology that is used to understand and quantify the system and its functions. Many modeling choices are available, and as described in Section 2.1.1 the CV system may have multiple functions. As a result, one may ask themselves what function or part of the cardiovascular system wants to model. Is the heat transfer from organs to the skin desired to be modeled? Or the fluid dynamics of the blood? Furthermore, one must determine the scale at which to model the system. Should the model describe interactions between cells? Or are macro-scale measurements such as pressure sufficient? Cardiovasculer system modeling therefore embraces many types of models and distinct scales. In this section a brief review of some modeling approaches is presented, with an emphasis on the type of model that is employed in this project. 2.2.1. Multiscale Modeling Approaches The cardiovascular system can be modeled at different length and time scales [35]. For example, one could model at the scale of a cell in order to study and predict effects of perturbations such as genetic mutations, the effects of certain drugs, or disease consequences on cells. One could also model at the scale of tissue. These models are used to study and quantify arrhythmias, which can be viewed as emergent properties of the cardiac system at the scale of tissue. Such models can also be used to investigate anatomical abnormalities and interactions with devices. Zooming out, there are organ scale models which can be used to model patient-specific geometry and cardiac structure. Finally, there are the whole body models, which can quantify functional variables such as pressure or volume in a cardiovascular compartment. Examples of the aforementioned models can be seen in Figure 2.6. Figure 2.6 Multiscale modeling. From bottom to the top: cell scale modeling, tissue/fiber scale modeling, organ (cardiac electrical and mechanical) modeling and finally whole body modeling. Adapted from [35]. In this work, a whole body model is used to simulate the physical variables that describe the blood circulation. Page 22 Master’s Thesis - Roger Pallar`es L´opez 2.2.2. Cardiovascular Hemodynamics Modeling Approaches Models that describe the physical variables that quantify cardiovascular characteristics are called hemodynamic models. A range of such models describe the CV system at distinct levels of detail. There are three main classes of hemodynamics models. These include, in order of decreasing complexity: three dimensional (3D) hemodynamic models, one dimensional (1D) hemodynamic models and zero dimensional (0D, or lumped parameter) hemodynamic models [18]. 3D hemodynamic models are those that study the blood as a vector field. Blood can be represented as an incompressible fluid. Its fluid dynamic behaviour can then be approximated by a Newtonian fluid model governed by the Navier-Stokes equations. Arterial vessels usually have compliant walls, which deform significantly due to the pulsation of blood pressure. In order to model this compliance, elastodynamic equations are coupled with Navier-Stokes equations. Due to their complexity, such models are usually used to describe local hemodynamic information of vessels in detail. However, they are rarely used to simulate the entire circulatory system. 1D hemodynamic models are those that study the blood as a wave propagating in a tube. Again, blood is considered an incompressible fluid. The 1D partial differential equations that govern this wave can be obtained by integrating the Navier-Stokes equations over the vessel’s cross-section. These models, much less complex than the 3D models, are usually used to simulate pressure and flow waveforms at any point of the arterial network, such as the central aortic pressure. Nevertheless, their complexity and computational demands make them challenging to use for simulating an entire circulatory system. 0D hemodynamic or lumped parameter models are those in which the circulatory system is often modeled by applying Windkessel theory [37]. The hypothesis underlying this theory is that the pressure in a deformable fluid container is homogeneous in space. Consequently, the circulatory system is grouped into different compartments that represent a specific part of it. These models are defined with ordinary differential equations, making them relatively simple to solve. Due to their simplicity, these models are not employed to study wave propagation or pressure waves in detail, but rather they are useful to estimate blood pressure changes [1], simulate the whole circulatory system [3] or for teaching purposes [13]. The type of model implemented in this project is a lumped parameter model, as it serves as a simulator used by a reinforcement learning algorithm to train policies. This model is explained in detail in Section 3.2. Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 23 2.3. Machine Learning This section is devoted to describe the basics of machine learning topics that appear in this thesis. A brief introduction to artificial neural networks is explained, together with the fundamental theory related to reinforcement learning. 2.3.1. Artificial Neural Networks Artificial neural networks (ANNs) are a type of supervised learning method that aim to learn a function from a set of input-output (or label) data. The simplest entity of an ANN is the so called perceptron. A perceptron is a linear combination of variables passed to an activation function (f): y=f(xωT+b) (2.4) where xis the vector of inputs, ωthe vector of weights and bthe bias. Regarding activation functions, there are many different types, including ReLu, Sigmoid or ELU [7]. Therefore, an ANN is formed by a set of perceptrons (or nodes) that are organized into different layers and linked among them. Those layers are: the input layer, the output layer and the hidden layers. The simplest architecture of ANN is called a multilayer perceptron (MLP) or feedforward neural network. In these kind of networks, the nodes of each layer are connected to the next layer, thus information travels forward, from the input layer to the output layer. In Figure 2.7 a simple architecture of a MLP is shown. Figure 2.7 Schema of a simple artificial neural network. Input nodes are denoted with x, hidden nodes with hand output node with y. Adapted from [7]. In order to train (optimize) an ANN, a function that quantifies the difference between the labels (or data outputs) and the outputs of the ANN is needed. This function is generally called the loss function: L(y(ω),˜y) (2.5) in which y(ω) are the outputs of the ANN that depend on its weights ωand ˜yare the labels. Finally, the training (optimization) of the ANN is carried out by employing the backpropagation algorithm. This algorithm is based on updating the weights of the ANN “backwards” using the Page 30 Master’s Thesis - Roger Pallar`es L´opez Figure 3.3 shows a flowchart for selecting CABG patients who satisfy criteria of data availability and data quality. The initial CABG cohort consisted of 2774 patients and 2812 encounters that occurred in MGH from March 2016 to February 2021. Note that an encounter refers to a specific instance when a patient was admitted to the hospital. Therefore, a given patient that underwent more than one CABG operation, during separate hospital stays, will have more than one encounter. Moreover, only the first 12 hours after the surgery were analyzed, since it is the period of time in which patients are heavily monitored in order to diagnose any complications that may occur. From the initial cohort, 1002 patients and 1039 encounters were removed from the data set because they did not have all the desired signals used in this work. Moreover, those patients who had signals which overlapped less than 20% of the total time, i.e., less than 2.5 hours, were also removed from the cohort. Finally, after outlier removal, patients whose signals overlapped for less than 20% of the 12 hours time window were again removed from the data set. The end result of patient selection cut down the initial cohort of 2774 patients and 2812 encounters to 1372 patients and 1373 encounters, which equals 48.8% of the initial cohort. Figure 3.3 Cohort reduction due to signal missingness and outlier removal. Demographic information for the final cohort is presented in Table 3.1. Patients were predominantly male (80%), at a mean age of 69 years, with a mean length of hospital stay of about 12 days. Moreover, the mortality of this cohort is nearly 6%. Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 31 Table 3.1 Demographic data of the final cohort (n= 1373). 3.1.4. Preprocessing and Final Dataset As justified and explained in Section 3.4, the signals used in this project are the patient’s systemic arterial pressure, central venous pressure, pulmonary artery pressure, cardiac output, and heart rate (Table 3.2). All of these signals come from BM database, although it must be noted that information from EDW was also employed to determine which patients underwent CABG, as well as to obtain demographic information (Table 3.1). Table 3.2 List of signals used in the project. Included information: the signal type and between parentheses their sample frequency, the equivalent mathematical symbol used throughout the whole study, the units, and a brief description of how they are measured. Once the final cohort of patients was selected, a set of preprocessing steps were performed in order to clean and transform the data required for CV parameter estimation using the system identification tool. First, signals were cleaned out of outliers by determining those values that were outside physiological ranges (Table 3.3 present these ranges). Second, all five signals were resampled at 120Hz and cut so as to have the same sample points and start/end time. Third, a Butterworth low-pass filter with a cut-off frequency of 8Hz was passed on the waveforms to remove remaining noise. The cut-off frequency of 8Hz was chosen as it is double of the highest heart rate, in this way ensuring no information from the cardiac cycles could be lost. Fourth, the signals were cut into cardiac cycles, by detecting the local minima of the arterial pressure signal (i.e. the diastolic pressure). Finally, corrupted or noisy signals that did not correspond to true cardiac cycles were removed, since artifacts in the signal sometimes introduced local minima that did not correspond to Page 32 Master’s Thesis - Roger Pallar`es L´opez the diastolic pressure. This was achieved by employing the dynamic time warping (DTW) technique, computing the similarity between a template cardiac cycle and the cycles cut from the signals. Table 3.3 Minimum and maximum achievable values for each cardiovascular system measurement, used to define ranges for outlier removal. As a final step, systemic arterial pressure, central venous pressure and pulmonary artery pressure were resampled at 50 samples per cardiac cycle. On the other hand, for cardiac output and heart rate, the mean over all the cycle was computed, taking only one value for the entire cycle. After performing all the aforementioned preprocessing steps, the final dataset used for parameter estimation contained 776341 cardiac cycles with information from all five signals. Summary statistics from the final dataset is shown in Table 3.4. Table 3.4 Summary statistics for the final dataset (n=776341) with systemic arterial pressure (Pa,s), central venous presure (Pv,s), pulmonary artery pressure (Pa,p), heart rate (HR) and cardiac output (CO) signals. 3.2. Cardiovascular Hemodynamics Model The cardiovascular (CV) model used to simulate the whole body hemodynamics during reinforcement learning training is the Burkhoff and Tyberg model [1]. This model is a 0D or lumped parameter model (see Section 2.2.2), in which the whole CV circulatory system is divided and grouped into 6 compartments: the left ventricle, the systemic arteries, the systemic veins, the right ventricle, the pulmonary arteries, and the pulmonary veins. Each compartment has its own cardiovascular parameters. Also, note that atria are included as part of the venous compartments and not modeled independently. In order to model each compartment, it is assumed that large arteries and veins are primarily compliance vessels, meaning that only small pressure gradients are needed to propel blood flow (cardiac output) through them. In contrast, their change in volume can be highly significant. On Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 33 the other hand, resistance to blood flow is concentrated in the tissues themselves (mainly arterioles and valves), where volume changes are less important but resistances give rise to large blood pressure drops. Moreover, compliance and resistance effects are modeled linearly (Equations 2.2 and 2.3, respectively). In Figure 3.4a the six compartments with the main CV parameters are schematized. In Figure 3.4b an equivalent electrical model is shown, which is helpful for understanding the equations presented in Section 3.2.2. (a) (b) Figure 3.4 Diagrams of the Burkhoff and Tyberg model. a) Six compartment model (parameters explained in Section 3.2.1). RV and LV stand for right and left ventricles, respectively. Extracted from [1]. b) Equivalent electrical circuit of the CV model (parameters explained in Section 3.2.1). RV and LV stand for right and left ventricles, respectively. SA and SV, systemic arteries and veins, respectively. PA and PV, pulmonic arteries and veins, respectively. MV, AoV, TV and PV, mitral, aortic, tricuspid and pulmonar valves, respectively. Adapted from [26]. 3.2.1. Model Parameters Model parameters can be divided into three groups, including those that characterize the heart, the circulation, or both. Heart parameters are those related to the time-varying ventricular contraction, as described next. The end-systolic elastance (Ees) denotes the highest elastance of the heart during the cardiac cycle. The moment of time at which this occurs is the end of the systole (Tes). The unstressed volume (V0) is the volume at which end-systolic pressure (Pes) is equal to zero. The heart relaxes with exponential decay with a time constant of relaxation (τ). Finally, there are scaling and exponent factors that characterize the end-diastolic pressure-volume relationship (EDPVR) Aand B, respectively. Note that each half (right and left) of the heart has its its own values for these Page 34 Master’s Thesis - Roger Pallar`es L´opez parameters. The circulation parameters are those related to the vessels and tissues. The characteristic resistance (Rc) is the resistance of the aortic and pulmonar valves, and proximal arteries. The arterial resistance (Ra) is the resistance of the arterioles. The venous resistance (Rv) is the resistance to venous return, and mitral and tricuspid valves. The arterial compliance (Ca) is the compliance of the arteries. The venous compliance (Cv) is the compliance of the veins. Note that each half of the CV circuit (systemic and pulmonic) has its own values for these parameters. Finally, there are a set of parameters common to multiple components of the circulatory system. These include the heart rate (HR) and the circulatory volumes: total blood volume (VT); stressed blood volume (VS), which is related to the volume that determines intravascular pressure; and unstressed blood volume (VU), which is the volume that remains constant regardless the circulatory pressure. A summary of all the model parameters are presented in Table 3.5, including their symbol as used in this project, their units, and typical values for a healthy man. Table 3.5 Baseline parameters. CV parameters with values appropriate for a healthy 75 kg man. RV and LV stand for right and left ventricle, respectively. Pul and Sys stand for pulmonic and systemic circulation, respectively. By tuning the values of these parameters, different CV states can be defined, such as a healthy subject at rest or during exercise, a patient with specific CV pathologies, a patient recovering from Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 35 surgery, and so on. These parameters can also be modified by drugs. As explained in Section 3.3.2, the reinforcement learning policy varied several of these parameters to simulate physician actions in the treatment of patients. 3.2.2. Model Equations The equations describing the CV model are explained in this section. In order to denote the pressure or volumen in a specific CV compartment the following subscripts are used:“a” for arteries, “v” for veins, “s” for systemic circulation, “p” for pulmonic circulation, “LV ” for left ventricle, and “RV ” for right ventricle. Moreover, specific moments in the cardiac cycle are denoted by the subscripts “es” and “ed” which stand for end-systole and end-diastole, respectively. The ventricular pumping characteristics are represented by a time varying function ((t)) that relates the ventricular pressure (P(t)) with the ventricular volume (V(t)). The (t) function is modeled as an increasing sine wave during systole and an exponential decay during diastole. Moreover, the ventricular pressure (P(t)) is split up into the end-systolic pressure (Pes(t)) and end-diastolic pressure (Ped(t)). The end-systolic pressure (Pes(t)) is linearly related to the ventricular volume (V(t)) by the end-systolic elastance (Ees). The end-diastolic pressure (Ped(t)) is related to the ventricular volume (V(t)) non-linearly with an exponential function. The equations for the left ventricle are the following: LV (t) =      1 2sin π Tes t−π 2+ 1for t < 3Tes 2 1 2exp −t−3Tes/2 τfor t≥3Tes 2 (3.1) Pes,LV (t) = Ees,LV (VLV (t)−V0,LV ) (3.2) Ped,LV (t) = ALV exp BLV (VLV (t)−V0,LV )−1(3.3) PLV (t) = Pes,LV (t)−Ped,LV (t)LV (t) + Ped,LV (t) (3.4) On the other hand, the equations for the right ventricle are: RV (t) =      1 2sin π Tes t−π 2+ 1for t < 3Tes 2 1 2exp −t−3Tes/2 τfor t≥3Tes 2 (3.5) Pes,RV (t) = Ees,RV (VRV (t)−V0,RV ) (3.6) Ped,RV (t) = ARV exp BRV (VRV (t)−V0,RV )−1(3.7) PRV (t) = Pes,RV (t)−Ped,RV (t)RV (t) + Ped,RV (t) (3.8) The pressure (P(t)) and volume (V(t)) from the systemic and pulmonic arteries and veins are Page 36 Master’s Thesis - Roger Pallar`es L´opez related linearly by their respective compliances (C): Pa,s(t) = Va,s(t)/Ca,s (3.9) Pv,s(t) = Vv,s(t)/Cv,s (3.10) Pa,p(t) = Va,p(t)/Ca,p (3.11) Pv,p(t) = Vv,p(t)/Cv,p (3.12) Changes in pressure (P(t)) and volume (V(t)) in the six compartments are described with a set of six differential equations, where flow (derivative of volume) is related linearly to the pressure by the appropriate resistance: dVLV (t) dt=Pv,p(t)−PLV (t) Rv,p αLV −PLV (t)−Pa,s(t) Rc,s βLV (3.13) dVa,s(t) dt=PLV (t)−Pa,s(t) Rc,s βLV −Pa,s(t)−Pv,s(t) Ra,s (3.14) dVv,s(t) dt=Pa,s(t)−Pv,s(t) Ra,s −Pv,s(t)−PRV (t) Rv,s αRV (3.15) dVRV (t) dt=Pv,s(t)−PRV (t) Rv,s αRV −PRV (t)−Pa,p(t) Rc,p βRV (3.16) dVa,p(t) dt=PRV (t)−Pa,p(t) Rc,p βRV −Pa,p(t)−Pv,p(t) Ra,p (3.17) dVv,p(t) dt=Pa,p(t)−Pv,p(t) Ra,p −Pv,p(t)−PLV (t) Rv,p αLV (3.18) where αLV ,βLV ,αRV and βRV are the representation of mitral, aortic, tricuspid and pulmonary valves, respectively. All valves are modeled as ideal valves allowing flow in only one direction: αLV =   1 if PLV (t)< Pv,p 0 otherwise (3.19) βLV =   1 if PLV (t)> Pa,s 0 otherwise (3.20) αRV =   1 if PRV (t)< Pv,s 0 otherwise (3.21) βRV =   1 if PRV (t)> Pa,p 0 otherwise (3.22) Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 37 Finally, the sum of the volume (V(t)) in all six compartments remains constant over time, and it is equal to the stressed volume (Vs): Vs=VLV (t) + Va,s(t) + Vv,s(t) + VRV (t) + Va,p(t) + Vv,p(t) (3.23) 3.2.3. Model Implementation and Assessment The whole CV model was implemented as a Python class in order to be modular and easily embeddable in the reinforcement learning framework. Differential equations were discretized and solved using the Euler’s method. For example, for any volume (V(t)): dV(t) dt=Q(t)→Vk+1 −Vk tk =Qk→Vk+1 =Vk+tk·Qk(3.24) where tkis the time step, which was chosen to be adaptive to the heart rate (HR). This time step adaptation was implemented because it was desired to simulate as fast as possible, while avoiding integration step instabilities. Since HR determines the speed of the cycle, and thus, the speed of the evolution of the dynamic variables (P(t) and V(t)), adapting the time step to this parameter was suitable. Time step adaptation corresponded to HR ranges: tk[ms] =                      8 for HR <75 5 for 75 ≤HR <140 3 for 140 ≤HR <180 1 for 180 ≤HR <200 0.5 for HR ≥200 (3.25) In order to assess the correctness of the implementation and debug possible errors, the Harvi simulator was used. Harvi is a more complex CV model also developed by Burkhoff, which is based on the model described in this thesis. Available to the lab team, its use helped determine the correctness of the model by comparing the evolution of pressures and volumes with baseline parameters. In the Results chapter (Section 4.1) PV loops from a healthy and unhealthy subject are presented and explained. Furthermore, a qualitative analysis comparing the arterial pressure obtained in simulation and from a real patient is performed. Advantages, similarities, and limitations of this CV model are discussed. Page 38 Master’s Thesis - Roger Pallar`es L´opez 3.3. Reinforcement Learning Framework The desired policy that performs therapy decisions on simulated patients was obtained by reinforcement learning (RL) training. RL was chosen over any other control techinque as it was considered suitable for the cardiogenic shock problem. The decision making nature of tailored therapy, together with the need to build a controller that is adaptive, learns from historical and data, and can handle both continuous and discrete actions, lead to consider RL appropriated for this problem. Therefore, a RL framework was developed to implement the deep Q-Network (DQN) algorithm that using the presented CV model as simulator, was able to train policies in different conditions. This section is meant to explain all the methodology related to the RL framework developed in this project. 3.3.1. Deep Q-Network Algorithm The DQN algorithm [21] is a model-free RL algorithm that tries to find the policy that maximizes the total return (see Equation 2.9). It works with continuous state spaces (S) and discrete action spaces (A) where action-triggered state transitions can be stochastic. In order to maximize the total return and find the optimal policy, DQN optimizes the action-value or Q-function (Q(s, a)). This function determines the expected return achievable by following a policy from given state (s∈ S) and then taking some action (a∈ A). Computing the optimal Q-function (Q∗(s, a)) can be challenging, thus the Bellman equation is commonly employed to optimize it recursively: Qi+1(st, at) = Qi(st, at) + α·(rt+γ·max a∈A Qi(st+1, a)−Qi(st, at)) (3.26) where Qi(st, at) is the current Q-function, α∈(0,1] is the learning rate, γ∈[0,1) is the discount factor, and maxaQi(st+1, a) is the estimate of optimal future value. This value iteration algorithm converges to the optimal Q-function if enough iterations are performed: Qi(s, a)→Q∗(s, a) if i→ ∞, and the optimal policy can be computed from the optimal Q-function as: π∗(s, a) = argmax a∈A Q∗(s, a) (3.27) In DQN, the Q-function is approximated with a neural network (NN) (Q(s, a)→Q(s, a, ω)) where ω are the weights of the NN. To train this NN and find the optimal Q-function, DQN takes advantage of the Bellman equation convergence, thereby, with enough iterations Qi+1(st, at) = Qi(st, at) and Equation 3.26 becomes: rt+γ·max a∈A Qi(st+1, a)−Qi(st, at)=0→Qi(st, at) = rt+γ·max a∈A Qi(st+1, a) (3.28) The equality from Equation 3.28 can be used to define a loss function for NN training: L=E[(ˆy−Q(s, a, θ))2] (3.29) Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 39 where ˆy=r+γmaxaˆ Q(s0, a, θ) are the labels obtained from the target Q-function ( ˆ Q(s0, a, θ)). The target Q-function ( ˆ Q(s0, a, θ)) is a copy of the trained Q-function (Q(s0, a, θ)) updated at periodic increment steps of the algorithm. Note that this implies that the training labels are changing over time as Q(s, a) evolves. The purpose of this target Q-function is to hold the training labels constant for a tunable number of iterations to help the algorithm converge. Finally, the data used to train the Q-function are obtained from a technique called experience replay. This technique uses the agent’s experiences at each time step as data for training, which include: the current state and action, the reward obtained and the next state (et= (st, at, rt, st+1)). Algorithm 1: Deep Q-learning with Experience Replay Initialize replay memory Dto capacity N; Initialize Q-function Q(s, a, ω) with random weights; Initialize target Q-function ˆ Q(s, a, ω) with same weights as Q(s, a, ω); for episode = 1, M do Initialize environment with states s0; for t = 1, T do With probability select a random action at otherwise select at= maxa∈A Q(st, a, ω) ; Execute action atand observe reward rtand next state st+1; Store experience et= (st, at, rt, st+1) in D; Sample random batch of experiences e1, . . . , eJfrom D; For each experience ejset: ˆyj=   rj,for terminal sj+1 rj+γ·maxaˆ Q(sj+1, a, ω) for non-terminal sj+1 Perform a gradient descent step on E(ˆyj−Q(φj, aj, ω))2, j = 1, . . . , J; Every Csteps, copy ˆ Q(s, a, ω) with same weights as Q(s, a, ω); end end Combining the pieces of the DQN results in the full algorithm schematized in Algorithm 1. First, both trained and target Q-function are initialized with random weights, as well as a buffer (replay memory D) with capacity N. Then, Mepisodes are performed. Note that an episode consists of an agent’s entire interaction with the environment, from initial to final interaction step. For each episode, the environment is initialized and the agent starts interacting with it. Action selection is carried out according to an -greedy policy, in which a random action is taken with probability and policy action (at= maxa∈A Q(st, a, ω)) is taken with probability 1 −. At each environment step, the whole experience (et= (st, at, rt, st+1)) is stored in the replay memory (D). Finally, a batch of experiences are taken and the policy is updated performing a gradient descent step according to the loss function in Equation 3.29. This is done until reaching the horizon T, when this process is Page 46 Master’s Thesis - Roger Pallar`es L´opez over, the process was parallelized over all computer resources with the help of Ray library, as this optimization is quite time consuming. The optimization was performed by maximizing the accumulated reward (PT t=0 R(s, a)) averaged over the last 50 episodes. A list of all the hyperparameters with their final value is presented in Table 3.7. Table 3.7 RL hyperparameters with optimized values through Bayesian Optimization. Several analyses were performed to assess the results of the presented implementation (Section 4.3). These were grouped into the following sets: 1. Assessment of DR robustness. Trained policies with and without DR were compared to evaluate the importance to include DR during the training phase of the policy. 2. Comparison of restricted policies. Three policies with restricted actions (one without actions that change Vs, another without actions that change HR. and another without actions that change Ees) were trained and compared in order to assess their limitations to reverse the decompensated state of CS patients, and thus, find out what are the most important actions. 3. Importance of penalty terms. Three policies with different reward functions were analyzed to evaluate the value of the penalty terms explained above. To do so, a policy with only the cardiac output reward (R(s, a) = R+(s, a)), a policy with both cardiac output and power penalty term reward (R(s, a) = R+(s, a)+R− pp(s, a)), and a policy with cardiac output, power and drug penalty term reward (R(s, a) = R+(s, a) + R− pp+dp(s, a)) were trained and compared. 4. Final policy assessment. As a final evaluation, the policy that performed the best on the previous analyses was tested in a more complex environment. A CS patient was not only simulated with initial low cardiac output, but also disturbances while the policy was treating the patient were included. In all cases, sample efficiency during training was compared by counting how many episodes were needed for convergence, as well as the maximum accumulated reward achieved. Also, performance of the policy was assessed by determining how many policy steps (or actions) it needed to restore the cardiac output, as well as its behavior once it reached the goal of 5.0L/min. Assessments included the analysis of cardiac output (CO), mean arterial pressure ( ¯ Pa,s), end-systolic elastance (Ees), stressed volume (Vs) and heart rate (HR) evolution, as well as the actions taken by the policy at each step. In some cases, it has not been necessary to assess all these variables to discuss the results, and figures of such variables have been included in the Appendix, Section A.2. Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 47 3.4. System Identification for Parameter Estimation In order to reduce the sim2real gap with domain randomization, realistic parameter ranges derived from patients must be found. To identify these ranges, a system identification tool was developed for the purpose of estimating a subset of the Burkhoff CV model parameters (Section 3.2.1), employing the data from the CABG cohort (Section 3.1.3). Concretely, the subset of parameters that were estimated included: the left and right end-systolic elastances (EesLV and EesRV ); the systemic and pulmonic arterial resistances (Ra,s and Ra,p); the four compliances (Ca,s,Cv,s,Ca,p and Cv,p); and finally, the stressed volume (Vs). Nine parameters in all. As stated in [23], the Burkhoff and Tyberg CV model is structural identifiable for the aforementioned subset of parameters if the following physiological variables are known: the systemic arterial pressure (Pa,s(t)), the pulmonary artery pressure (Pa,p(t)), the stroke volume (SV ) and the heart rate (HR). This fact justifies the selection of signals in the final dataset (Section 3.1.4). Furthermore, the central venous pressure (Pv,s(t)) was also included as it was available on the patient’s recorded signals. It was thought that including this last signal could add valuable information for the parameter estimation. 3.4.1. Modification of Autoencoder for System Identification System identification was framed as a supervised learning problem. A deep multilayer perceptron (MLP) was trained to estimate the parameters from the signals on the dataset. However, it should be noted that no labels were available, as these CV parameters are not estimated in the hospital (if they were, the identification problem would have been already solved). Therefore, a strategy based on a modified autoencoder was implemented to train the deep MLP. Briefly, an autoencoder is a specific architecture of neural network (NN) based on an encoder, decoder and a latent space. Usually, the aim of an autoencoder is to learn a representation (latent space) of a set of data by encoding it. It is trained by introducing the same information as input and labels, thus the autoencoder learns to encode the data and then to decode it. In Figure 3.8 a representation of an autoencoder is shown. In the approach taken in this project, an autoencoder was trained to estimate the CV parameters by forcing the latent space to be the specific space of nine parameters described above. This specification could be achieved by training the decoder and the encoder separately. First, the decoder was trained with simulated data to mimic the CV simulator – given the nine parameters it would produce a cardiac cycle’s worth of state data. It should be noted that ideally, the simulator could have been used as decoder. However, due to the parallelization needs over a GPU and the backpropagation algorithm for NN training, this other approach was followed. With the decoder able to generate state data from parameters, the encoder could be trained to Page 48 Master’s Thesis - Roger Pallar`es L´opez generate parameters using real patient data as input. In this framework only the encoder was trained with real data. It was assumed that the decoder, which reproduces the CV simulator output, would be capable of generating state data (e.g. intracardiac and intravascular pressures and volumes) that are sufficiently similar to real patient data, provided that the encoder converted these data to a latent space close to the nine CV parameters. Thus, the trained encoder in this setup can be seen as a system identificatation algorithm for estimating the subset of CV parameters. Figure 3.8 Schematic representation of an autoencoder architecture. 3.4.2. System Identification Implementation and Assessment Both the architecture and the training of the autoencoder were performed with TensorFlow (TF) library. In order to train the decoder with simulated data, 0.7 million cardiac cycles that contained information about the arterial pressure (Pa,s(t)), the central venous pressure (Pv,s(t)) the pulmonary artery pressure (Pa,p(t)), the stroke volume (SV ) and heart rate (HR) were generated using the simulator. Moreover, the corresponding CV parameters employed to generate these data were stored for the training process. The input vector of the decoder was the subset of nine CV parameters plus the heart rate: xdec = [EesLV , EesRV , Ra,p, Ra,s, Ca,s, Cv,s, Ca,p, Cv,p, Vs,HR]T∈R10 (3.33) The output vector consisted of the three pressures resampled at 50 samples per cycle plus the stroke volume repeated 10 times: ydec = [Pa,s,Pv,s,Pa,p,SV]T∈R160 (3.34) Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 49 The loss function was the mean squared error between the output vector and the data (simulated pressures and stroke volume) ˆysim: L=MSE(ydec,ˆysim) (3.35) In contrast to the decoder, the encoder was trained with both simulated data and the patients dataset. Recalling that the dataset contained the mean value of the cardiac output and heart rate, but not the stroke volume, this last was computed using Equation 2.1. The input vector of the encoder was the three pressures resampled at 50 samples per cycle, the stroke volume repeated 10 times and the heart rate repeated also 10 times: xenc = [Pa,s,Pv,s,Pa,p,SV,HR]T∈R170 (3.36) The output vector consisted of the subset of nine CV parameters: yenc = [EesLV , EesRV , Ra,p, Ra,s, Ca,s, Cv,s, Ca,p, Cv,p, Vs]T∈R9(3.37) Given that the encoder was trained within the whole autoencoder architecture, the loss function used for training was the mean squared error between the decoder’s output (state) vector and the patient’s state data (pressures and stroke volume) ˆyreal: L=MSE(ydec,ˆyreal) (3.38) Once the encoder was trained, the entire CABG dataset was passed to it again to find the corresponding latent space vector, i.e, estimates of the nine CV parameters across the whole patient dataset. Figure 3.9 schematizes the entire process. Figure 3.9 Process followed to obtain the system identification tool. Step 1: train the decoder with simulated data. Step 2: train the encoder with the whole autoencoder architecture using both simulated and real patient data. Step 3: estimate the 9 CV parameters from the CABG dataset. Page 50 Master’s Thesis - Roger Pallar`es L´opez Note that in order to improve the training process for both encoder and decoder, the data were normalized. Parameter vectors (xdec and yenc) were normalized so that the min and max values fell in the range of [−1,1]. Cardiac cycle vectors (ydec and xenc) were standardized to have zero mean and unit standard deviation. Values for doing such normalization processes were found from the simulated data (Table A.1 in the Appendix (Section A.1) shows these values). Moreover, dropout, L2regularization and the early stopping technique were applied to improve encoder and decoder generalization. Note that early stopping is a method that determines the number of epochs to train the NN. It does so by finding when the validation loss starts to increase, a sign that the model starts to overfit. Just as in the RL framework, hyperparameters of the encoder and decoder were optimized with Bayesian Optimization (again employing SkOpt and Ray libraries). In this case, the optimization was performed by maximizing the accuracy of the validation set. Concretely, data was split into a training set of 75% and a validation set of 25%. A five fold cross validation process was performed and the resulting validation accuracy was the score to maximize. Note that the accuracy was measured with the cosine similarity between the output vector and labels, as the NN generates a vector of data: acc = cos(θ) = ydec ·ˆyreal kydeckkˆyrealk(3.39) A list of all the hyperparameters with their final value is presented in Table 3.8. Moreover, an scheme of the architecture used for both encoder and decoder is shown in Figure 3.10. Table 3.8 Autoencoder hyperparameters with optimized values through Bayesian Optimization. Figure 3.10 NN architectures of both encoder and decoder. Each box represents a layer. Between parenthesis are presented the number of neurons and the activation function. Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 51 In order to assess the autoencoder implementation and get the estimation of the nine CV parameters, diverse stages were defined and evaluated separately. First, the decoder training was apprised with its training curves and comparing the waves obtained with baseline parameters (Table 3.5). Pressure waves and stroke volume were compared with the ones obtained using the simulator. The root mean square error (RMSE) was used to get quantitative results. Then, the encoder training was assessed also with its training curves. Again, baseline parameters were compared to the ones obtained by the encoder, when introducing simulated waves. The absolute relative error was obtained to quantitatively describe differences. Finally, the encoder was employed to estimate the distribution of the nine CV parameters using CABG data. Mean and standard deviation of the distribution of each parameter were computed and compared to literature parameters. The estimated mean and standard deviation were also used to define the ranges of the domain randomization technique. Page 52 Master’s Thesis - Roger Pallar`es L´opez Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 53 4. RESULTS AND DISCUSSION Results from this project are presented and discussed in this chapter. First, results related to the implementation of the Burkhoff and Tyberg cardiovascular (CV) model are presented. Second, the training of the system identification tool and the set of CV parameters it produces is shown. Finally, the results of reinforcement learning (RL) for treating cardiogenic shock are described, including both policy training and performance. 4.1. Cardiovascular Simulation with Burkhoff and Tyberg Model In this section the CV model implemented as a simulator is presented. Simulations from a typical healthy and a typical heart failure patient are described and compared. Next, limitations of the model are pointed out by comparing a simulated arterial pressure wave to a real waveform from a CABG patient. 4.1.1. Analysis of Simulated Patients A healthy individual and patient with a cardiomyopathy were simulated with the Burkhoff and Tyberg CV model. Healthy values of the CV parameters (Table 3.5) were employed to simulate the healthy subject. In contrast, the patient with a cardiomyopathy was modeled by a decreasing the value of the left ventricle end-systolic elastance (EesLV = 1mmHg/mL); the remaining parameters were fixed at healthy values. Figure 4.1 presents the left ventricle pressure-volume (PV) loop from both patients. The PV loop presents relevant information about the heart’s state. The changes in ventricular pressure associated with changes in volume that occur during a cycle have valuable information to determine whether a subject’s heart function is impaired. For instance, information about the volume can be assessed. A healthy patient (Figure 4.1a) exhibits a stroke volume (SV ) equal to the difference between end-diastolic and end-systolic volumes (vertical lines) of almost 70mL, which when multiplied by the heart rate (HR), gives a cardiac output (CO) of 5.2L/min. On the other hand, the patient (Figure 4.1b) with a cardiomyopathy exhibits a SV of about 46mL, which when multiplied by the HR, gives a CO of 3.4L/min. Cardiac outputs lower than 4L/min with HR above 60bpm are abnormal and may reflect cardiac pathology. In addition to cardiac state, the PV loop captures information on the pressure and the relationships Page 54 Master’s Thesis - Roger Pallar`es L´opez between pressure and volume during the cardiac cycle. Systolic pressure can be approximated by the highest pressure value on the PV loop, and diastolic pressure when the aortic valve opens (top of the right vertical line). The end systolic pressure-volume relationship (ESPVR), which describes contractility (end-systolic elastance Ees), can be obtained by dividing the pressure by the volume when the aortic valve closes, i.e., end-systolic pressure and volume (top of the left vertical line). For example, the healthy subject exibits an end-systolic pressure (Pes) of 100mmHg and an end-systolic volume (Ves) of 34mL. The ratio of these values gives the LV end-systolic elastance (EesLV = 3mmHg/mL). The same can be done for the sick patient (Pes = 70mmHg,Ves = 70mL), giving an LV end-systolic elastance that is characteristic of cardiomyopathy (EesLV = 1mmHg/mL). 40 60 80 100 120 LV Volume [mL] 0 20 40 60 80 100 120 LV Pressure [mmHg] Cardiac output [L/min]: 5.19 Heart rate [bpm]: 75 Stroke volume [mL]: 69.24 PV Loop (a) 40 60 80 100 120 LV Volume [mL] 0 20 40 60 80 100 120 LV Pressure [mmHg] Cardiac output [L/min]: 3.43 Heart rate [bpm]: 75 Stroke volume [mL]: 45.69 PV Loop (b) Figure 4.1 Left ventricle pressure-volume loop. a) Healthy subject with baseline parameters. b) Subject with cardiomyopathy represented by a reduction of the left ventricle end-systolic elastance (EesLV = 1mmHg/mL). 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 Time [s] 40 50 60 70 80 90 100 110 Pressure [mmHg] Normal Arterial Pressure (a) 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 Time [s] 40 50 60 70 80 90 100 110 Pressure [mmHg] Abnormal Arterial Pressure (b) Figure 4.2 Simulated arterial pressure (Pa,s). a) Healthy subject with baseline parameters. b) Subject with cardiomyopathy represented by a reduction of the left ventricle end-systolic elastance (EesLV = 1mmHg/mL). Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 55 The arterial pressure is the one of the most common waveforms used by physicians. It also includes important information about the patient’s state. Figure 4.2 displays arterial pressure tracings generated by the simulator for a healthy subject and for a patient. Typical features that are extracted from this tracing include the HR, the systolic (maximum), diastolic (minimum) and mean pressures. Normal values for systolic pressure range between 90 −120mmHg, for diastolic pressure between 50 −80mmHg, and for the mean between 70 −100mmHg. It can be appreciated that in the simulated healthy patient, all pressure values lie inside the normal ranges (Psys = 104mmHg,Pdias = 40mmHg,Pmean = 54.5mmHg). However, the patient with cardiomyopathy exhibits hypotension: systolic, diastolic and mean pressures are all below the normal ranges (Psys = 69mmHg,Pdias = 40mmHg,Pmean = 54.5mmHg). This is due to the fact that this patient is assigned a low contractility (low end-systolic elastance) in simulation, which results in a low stroke volume and therefore a low arterial pressure. 4.1.2. Comparison with Real Data A typical arterial pressure wave from a CABG patient was extracted and compared with a simulated one to evaluate limitations of the Burkhoff and Tyberg CV model. Note that the focus of the comparison is on the shape of the waves rather than the exact pressure values. Both waves are showed in Figure 4.3. 0.0 0.5 1.0 1.5 2.0 2.5 Time [s] 60 70 80 90 100 110 Pressure [mmHg] Real Arterial Pressure (a) 0.0 0.5 1.0 1.5 2.0 2.5 3.0 Time [s] 60 70 80 90 100 Pressure [mmHg] Simulated Arterial Pressure (b) Figure 4.3 Comparison of real and simulated arterial pressure (Pa,s). a) Real arterial pressure from one CABG cohort patient. b) Simulated arterial pressure. Three main differences between the real wave and the simulated one can be identified: variation in the amplitude of the real patient, a second peak when the pressure is decreasing, and a smaller curvature at the diastolic pressure during the transition between diastole and systole. The variation in the amplitude present in the real arterial pressure is due to respiration and its interactions with the CV system, an effect that is not considered in this CV model. As stated in [2], respiration varies the amplitude of the arterial pressure wave and this can be appreciated as a low frequency Page 62 Master’s Thesis - Roger Pallar`es L´opez hearts have not yet been significantly damaged by coronary artery disease. As a result, the means of these distributions in such patients would be expected to be close to healthy values. However, right ventricle end-systolic elastance does differ markedly from the literature value (absolute RE of 380% between estimated mean and literature parameter). Also, pulmonic venous compliance is significantly different, with an absolute RE of 127%. Another problem with the estimation that can be appreciated from Figure 4.8 is that some parameters distributions have left tails with negative values. Negative CV parameter values are not physiologic, and might be the result of limitations of the decoder working as the simulator. During training the encoder may have learned that producing negative values of the CV parameters (latent variables) and passing them to the decoder nevertheless generated reasonable approximations to the pressure waves. To sum up, although the estimated mean of the nine CV parameters looks promising, this system identification tool needs to be refined and improved. Future work considers to put efforts on improving this strategy to be able to get only positive parameters and a better estimation of certain parameters such as the right ventricle end-systolic elastance. In summary, although the estimated means of the nine CV parameters look promising, this system identification tool needs to be improved. Future work will focus on constraining the output of the encoder to be positive and improving the estimation of certain parameters such as the right ventricle end-systolic elastance. In order to obtain parameter ranges for the DR, the first approach that was tried was to use the estimated mean ±standard deviation from Table 4.4. However, those ranges proved to be too wide to for the policy to converge. In fact, as shown in [22], a strategy of gradually enlarging the DR ranges as the policy was learning was an effective way to achieve convergence over a wide ranges of system parameters. In future work, such a strategy will be implemented. For this project the approach that was successful was to reduce the parameter ranges further. Specifically, parameter ranges were set at the estimated mean ±one third of the standard deviation. Furthermore, the right and left ventricular end-systolic elastances and stressed volume were permitted to change to arbitrarily small or large values to simulate a patient in cardiogenic shock whose cardiac output was low. The final ranges of the nine CV parameters used in the DR were: EesRV [mmHg/mL]∈[0.42,0.98], EesLV [mmHg/mL]∈[0.8,1.4], Ra,p[mmHg ·s/mL]∈[0.023,0.053], Ra,s [mmHg ·s/mL]∈[0.658,0.852], Ca,p [mL/mmHg]∈[8.16,13.84], Ca,s [mL/mmHg]∈[1.07,1.66], Cv,p [mL/mmHg]∈[15.29,21.05], Cv,s [mL/mmHg]∈[43.57,59.23], Vs[mL]∈[650,850] Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 63 4.3. Reinforcement Learning for Cardiogenic Shock Patients This final section presents the results from the reinforcement learning (RL) experiments. First, the effect of DR on policy robustness is assessed. Second, policies with restricted actions are analyzed and compared. Third, the importance of penalty terms is evaluated. Finally, the performance of the best policy is discussed in detail. Note that in all cases, modeling a patient in cardiogenic shock (CS) was achieved by setting the CV parameters of the model in a configuration that resulted in an initial state with a low cardiac output (below 3.5L/min). The learning objective was to identify a policy that could restore cardiac output to a normal range (at least 5.0L/min) by modulating a subset of the CV parameters (explained in detail in Section 3.3.4). Moreover, the hyperparameters used to train the policies are presented in 3.7. 4.3.1. Assessment of Domain Randomization Robustness Assessment of the importance of domain randomization (DR) was carried out by training a policy without DR and a policy with DR. The policy trained without DR always interacted with a CV model with the same parameter values (corresponding to shock) at the beginning of every episode. In both cases, the reward function included the reward for cardiac output plus the power penalty term (R(s, a) = R+(s, a) + R− pp(s, a)). 0 50 100 150 200 250 300 350 Episodes 0 20 40 60 80 100 120 140 160 Accumulated Reward Training Evolution Reward per episode Averaged reward Upper bound: horizon (a) 0 50 100 150 200 250 300 350 Episodes 0 20 40 60 80 100 120 140 160 Accumulated Reward Training Evolution Reward per episode Averaged reward Upper bound: horizon (b) Figure 4.9 Policy training curves with reward per episode (blue), averaged reward over 10 episodes (orange) and training horizon (dashed black). a) Policy trained without domain randomization (DR). b) Policy trained with domain randomization (DR). The training curves for the two approaches are shown in Figure 4.9. Both policies converge at practically the same moment, at around 150 episodes. However, the policy trained without DR exhibits less noise during training and achieves a slightly higher accumulated reward, 146, compared to 142 with DR. This slight reduction in reward might be expected, as DR creates variability in the CV parameters, forcing the policy to generalize over different CV environments at some cost to Page 64 Master’s Thesis - Roger Pallar`es L´opez overall performance. To directly compare the two policies each one was evaluated on a CV environment with the same parameters: the baseline values (Table 3.5) together with low LV end-systolic elastance (EesLV = 1mmHg/mL), which is the same CV environment used to train the policy without DR. Results show that both policies are able to restore the cardiac output (Figure 4.10a) and mean arterial pressure (Figure 4.10b) in the simulated patient, getting final values of around 5.5L/min and 90mmHg, respetively. However, the policy trained with DR achieves the goal with moderately more noise and somewhat higher values of cardiac output compare to the policy trained without DR. This may be happening due to a trade-off between robustness achieved by the DR and performance. The policy with DR should be more robust, but at the same time could have poorer performance. 0 10 20 30 40 50 Policy Steps 3.5 4.0 4.5 5.0 5.5 6.0 Cardiac Output [L/min] Evolution of Cardiac Output Without DR With DR (a) 0 10 20 30 40 50 Policy Steps 60 65 70 75 80 85 90 95 Pressure [mmHg] Evolution of Mean Arterial Pressure Without DR With DR (b) Figure 4.10 Policy performance from training initial conditions without domain randomization (baseline parameters with low LV end-systolic elastance (EesLV = 1mmHg/mL)). Comparison of policies trained without (blue) and with (orange) DR. a) Cardiac output (CO). b) Mean arterial pressure ( ¯ Pa,s). In order to assess DR robustness, both policies were evaluated on a set of initial CV parameters not seen by either approach during training. The CV parameters were set at the baseline parameters with even lower LV end-systolic elastance (EesLV = 0.6mmHg/mL) and pathological high systemic venous resistance (Rv,s = 0.06mmHg ·s/mL). As can be seen in Figure 4.11, the policy trained without DR is not able to restore the cardiac output to a normal value above 5.0L/min. On the other hand, the policy trained with DR, despite facing a new environment, is capable of recovering the cardiac output by rising it to 5.3L/min. The value of DR is highlighted by this example, in which a policy can still perform well when operating in an unexpected environment. Therefore, training a policy with DR may be a valuable approach for closing the sim2real gap in the management of CS. Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 65 0 10 20 30 40 50 Policy Steps 2.5 3.0 3.5 4.0 4.5 5.0 5.5 Cardiac Output [L/min] Evolution of Cardiac Output Without DR With DR (a) 0 10 20 30 40 50 Policy Steps 50 60 70 80 90 Pressure [mmHg] Evolution of Mean Arterial Pressure Without DR With DR (b) Figure 4.11 Policy performance from initial conditions not used during training (baseline parameters with low LV end-systolic elastance (EesLV = 0.6mmHg/mL) and high systemic venous resistance (Rv,s = 0.06mmHg ·s/mL)). Comparison of policies trained without (blue) and with (orange) DR. a) Cardiac output (CO). b) Mean arterial pressure ( ¯ Pa,s). 4.3.2. Comparison of Restricted Policies Policies with restricted actions were trained and evaluated to assess the relative importance of different actions. This experiment could also be viewed as modeling a scenario wherein a particular intervention was contraindicated (off-limits, e.g. due to allergy) for a patient. Three different policies were trained: a policy without actions to change the stressed volume (Vs), a policy without actions to change the heart rate (HR), and a policy without actions to change the end-systolic elastance (Ees). All three policies were trained with DR and the reward function included both the positive reward for cardiac output plus the power penalty term (R(s, a) = R+(s, a)+R− pp(s, a)). For each policy, five rounds of training were performed and the trained policy with the best performance was used for evaluation. Training curves are presented in Figure 4.12. The policy without HR actions converges faster during training and achieves a final accumulated reward of 141. On the other hand, the policy without Ees converges more gradually and achieves a lower accumulated reward of about 120. An open question to be analyzed in the future is whether optimizing the hyperparameters for each choice of action space would improve policy convergence and accumulated reward. Page 66 Master’s Thesis - Roger Pallar`es L´opez 0 50 100 150 200 250 300 350 Episodes 0 20 40 60 80 100 120 140 160 Accumulated Reward Training Evolution Reward policy no Vs Reward policy no HR Reward policy no Ees Upper bound: horizon Figure 4.12 Policy training curves with mean (line) ±standard deviation (shaded region) of averaged reward over 10 episodes. 5 policies trained for each case: policy without stressed volume (Vs) actions (blue), policy without heart rate (HR) actions (orange), and policy without end-systolic elastance (Ees) actions (red). Horizon represented with black dashed line. 0 10 20 30 40 50 Policy Steps 3.0 3.5 4.0 4.5 5.0 5.5 6.0 Cardiac Output [L/min] Evolution of Cardiac Output Policy no Vs Policy no HR Policy no Ees (a) 0 10 20 30 40 50 Policy Steps 50 60 70 80 90 Pressure [mmHg] Evolution of Mean Arterial Pressure Policy no Vs Policy no HR Policy no Ees (b) Figure 4.13 Policy performance from the three restricted policies. Initial conditions: baseline parameters with low LV end-systolic elastance (EesLV = 0.8mmHg/mL) and high systemic venous resistance (Rv,s = 0.04mmHg ·s/mL). Comparison of policies trained without stressed volume (Vs) actions (blue), without heart rate (HR) actions (orange), and without end-systolic elastance (Ees) actions (red). a) Cardiac output (CO). b) Mean arterial pressure ( ¯ Pa,s). The performance of the three policies was compared by setting up the following initial conditions: baseline parameters with low LV end-systolic elastance (EesLV = 0.8mmHg/mL) and high systemic venous resistance (Rv,s = 0.04mmHg ·s/mL). Results show that the policy without actions to change HR restores the cardiac output (Figure 4.13a) and mean arterial pressure (Figure 4.13b) Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 67 the fastest, obtaining final values of around 5.7L/min and 93mmHg. On the other hand, policies without Vsand Ees actions have greater difficulty to treating the simulated patient with CS. In fact, both policies achieve similar performance, taking 30 policy steps to raise the cardiac output to 5L/min. These results imply that actions that change HR are less important than the actions that change either Vsor Ees. 0 10 20 30 40 50 Policy Steps Decrease Vs Maintain Vs Increase Vs Decrease HR Maintain HR Increase HR Decrease Ees Maintain Ees Increase Ees Action Type Policy Actions (a) 0 10 20 30 40 50 Policy Steps Decrease Vs Maintain Vs Increase Vs Decrease HR Maintain HR Increase HR Decrease Ees Maintain Ees Increase Ees Action Type Policy Actions (b) 0 10 20 30 40 50 Policy Steps Decrease Vs Maintain Vs Increase Vs Decrease HR Maintain HR Increase HR Decrease Ees Maintain Ees Increase Ees Action Type Policy Actions (c) Figure 4.14 Actions from the three restricted policies. a) Policy without stressed volume (Vs) actions. b) Policy without heart rate (HR) actions. c) Policy without end-systolic elastance (Ees) actions. A closer look at the actions taken by each policy (Figure 4.14) reveals further insights. First, the policy without Vsactions (Figure 4.14a) increases the cardiac output simply by continually rising the end-systolic elastance all the time, and it rarely ever uses the HR action. This behavior reinforces the conclusion that changes in HR have smaller impact on cardiac output and thus, actions that manipulate it are less important. Regarding the policy without HR actions (Figure 4.14b), it first increases both Ees and Vsto reach the desired cardiac output as fast as possible. Then, in order to maintain the cardiac output at the healthy value, the policy keeps Ees constant and oscillates Vs, Page 68 Master’s Thesis - Roger Pallar`es L´opez increasing and decreasing it successively. This oscillatory behavior occurs because the policy, when reaches the goal cardiac output of 5.5L/min, it has freedom to do whatever it wants, provided that the cardiac output is maintained. This undesirable behavior is addressed in the next section by introducing a “drug” (action) penalty term. Finally, the policy without Ees actions (Figure 4.14c) raises the cardiac output by increasing both HR and Vs. In this case HR actions are successfully employed, which might reflect the fact that at higher blood volumes (increase of Vs), rising HR has a greater effect on increasing cardiac output. 4.3.3. Importance of Penalty Terms The importance of penalty terms was assessed by training three different policies: one without any penalty terms (R(s, a) = R+(s, a)), another with the power penalty term (R(s, a) = R+(s, a) + R− pp(s, a)), and a third with both power and drug penalty terms (R(s, a) = R+(s, a)+R− pp+dp(s, a)). All three policies were trained with DR and for each policy, five rounds of training were performed; the trained policy with the best performance was chosen for further evaluation. Training curves are presented in Figure 4.15. The policy without penalty terms converged much faster than the other two, after only 60 episodes. On the other hand, the policy with only a power penalty term needed about 200 episodes to converge. Interestingly, the policy with both a power penalty and a drug penalty term took 150 episodes to converge, showing that drug penalty may help on convergence. Regarding total reward, all three policies achieved a similar accumulated reward of 140 upon convergence. 0 50 100 150 200 250 300 350 Episodes 0 20 40 60 80 100 120 140 160 Accumulated Reward Training Evolution Policy without penalties Policy with power penalty Policy with power + drug p. Upper bound: horizon Figure 4.15 Policy training curves with mean (line) ±standard deviation (shaded region) of averaged reward over 10 episodes. 5 policies trained for each case: policy without penalty terms (blue), policy with only power penalty term (orange), and policy with both drug and power penalty terms (red). Horizon represented with black dashed line. Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 69 The three policies were evaluated by setting up the same initial conditions as before: baseline parameters with low LV end-systolic elastance (EesLV = 0.8mmHg/mL) and high systemic venous resistance (Rv,s = 0.04mmHg ·s/mL). Results show that the policy without any penalty terms has freedom to increase cardiac output (Figure 4.16a) as much as it wants, reaching a value of around 6.5L/min. This in turn induces hypertension in the simulated patient, a pathologic condition, with values of mean arterial pressure (Figure 4.16b) reaching 110mmHg. On the other hand, introducing the power penalty term encourages the policy to not increase the cardiac output excessively (around 5.6L/min) and thus avoiding hypertension. However, an undesirable oscillatory behavior occurs as seen in previous experiments. These oscillations can be removed by including the drug penalty term, which penalizes the policy for taking many actions. This last penalty forces the policy to only take actions when necessary, and once the cardiac output level is reached, it is encouraged to take no further parameter altering actions. 0 10 20 30 40 50 Policy Steps 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 Cardiac Output [L/min] Evolution of Cardiac Output Policy without penalties Policy with power penalty Policy with power + drug p. (a) 0 10 20 30 40 50 Policy Steps 50 60 70 80 90 100 110 Pressure [mmHg] Evolution of Mean Arterial Pressure Policy without penalties Policy with power penalty Policy with power + drug p. (b) Figure 4.16 Policy performance from the three policies with different penalty terms. Initial conditions: baseline parameters with low LV end-systolic elastance (EesLV = 0.8mmHg/mL) and high systemic venous resistance (Rv,s = 0.04mmHg ·s/mL). Comparison of policies trained without penalty terms (blue), with only power penalty term (orange), and with both drug and power penalty terms (red). a) Cardiac output (CO). b) Mean arterial pressure ( ¯ Pa,s). Taking a closer look at cardiac power output (4.17), which is a measure of how much power the heart is consuming, it can be seen that the policy without penalty terms exceeds 1.2W. Such high cardiac power outputs are likely detrimental to the heart itself and its recovery. Moreover they result in adverse systemic effects such as hypertension. On the other hand, policies with the power penalty maintained power outputs below 1.2W. Finally, the effect of the drug penalty term can be appreciated in Figure 4.18. Without this penalty (4.18a), the policy behaves in an oscillatory way. First, it takes the appropriate actions to increase the cardiac output fast to 5.5L/min, but then it alternates opposing actions (e.g. increase/decrease Vs) to maintain the desired cardiac output level. On the other hand, when adding the drug penalty, Page 70 Master’s Thesis - Roger Pallar`es L´opez the policy only acts when necessary. As shown in Figure 4.18b, once the policy raises the cardiac output to the desired level, it does not apply any other action. 0 10 20 30 40 50 Policy Steps 0.4 0.6 0.8 1.0 1.2 1.4 1.6 Power [W] Evolution of Cardiac Power Output Policy without penalties Policy with power penalty Policy with power + drug p. Figure 4.17 Cardiac power output (CPO) comparison from the three policies: without penalty terms (blue), with only power penalty term (orange), and with both drug and power penalty terms (red). 0 10 20 30 40 50 Policy Steps Decrease Vs Maintain Vs Increase Vs Decrease HR Maintain HR Increase HR Decrease Ees Maintain Ees Increase Ees Action Type Policy Actions (a) 0 10 20 30 40 50 Policy Steps Decrease Vs Maintain Vs Increase Vs Decrease HR Maintain HR Increase HR Decrease Ees Maintain Ees Increase Ees Action Type Policy Actions (b) Figure 4.18 Actions from policies with power and with both penalty terms. a) Policy without penalty terms. b) Policy with both power and drug penalty terms. 4.3.4. Final Policy Assessment A final test was created to assess the policy trained with DR and a reward that included both penalty terms plus the reward to cardiac output (R(s, a) = R+(s, a) + R− pp+dp(s, a)). In particular, the policy’s performance was evaluated on a more complex environment with time-dependent dis- Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 71 turbances. As before, the simulated patient (environment) was initialized with parameters leading to cardiogenic shock. But after the policy had interacted with the environment, two of the parameters were altered, simulating a “relapse” and subsequently “healing”. Concretely, initial conditions were set with baseline parameters, a low LV end-systolic elastance (EesLV = 0.8mmHg/mL), and a high systemic venous resistance (Rv,s = 0.03mmHg ·s/mL). Relapse was modeled with a disturbance after 40 policy steps and consisted of a: sudden reduction in LV end-systolic elastance (EesLV = 1.0mmHg/mL) and increment of systemic venous resistance (Rv,s = 0.05mmHg ·s/mL). Finally, the healing was modeled with a second disturbance at 80 policy steps, consisting of a: sudden reduction in systemic venous resistance to its healthy value (Rv,s = 0.015mmHg ·s/mL). These disturbances are depicted in orange in Figure 4.20. The evolution of cardiac output and mean arterial pressure are shown in Figure 4.19. From the initial conditions, the policy increases both cardiac output and mean arterial pressure to restore the patient from the decompensated state, achieving values of 5.6L/min and 91mmHg, respectively. Once the disturbance simulating the patient’s relapse appears, the policy reacts to it counteracting the effect and restoring the cardiac output and mean arterial pressure to target values. Finally, after introducing the disturbance that represents healing, the policy notices a high cardiac output and mean arterial pressure and reduces them, obtaining a final cardiac output close to 5.5L/min and a mean arterial pressure of 88mmHg. 0 20 40 60 80 100 120 Policy Steps 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 Cardiac Output [L/min] Evolution of Cardiac Output (a) 0 20 40 60 80 100 120 Policy Steps 50 60 70 80 90 100 Pressure [mmHg] Evolution of Mean Arterial Pressure (b) Figure 4.19 Final policy performance with disturbances. Initial conditions: baseline parameters with low LV end-systolic elastance (EesLV = 0.8mmHg/mL) and high systemic venous resistance (Rv,s = 0.03mmHg ·s/mL). First disturbance at 40 policy steps: sudden reduction of LV end-systolic elastance (EesLV = 1.0mmHg/mL) and increment of systemic venous resistance (Rv,s = 0.05mmHg ·s/mL). Second disturbance at 80 policy steps: sudden reduction of systemic venous resistance to its healthy value (Rv,s = 0.015mmHg ·s/mL). a) Cardiac output (CO). b) Mean arterial pressure ( ¯ Pa,s). Looking carefully at the evolution of parameters changed by the policy (4.20), one can appreciate that in order to counteract the decompensated state with high systemic venous resistance (Rv,s) Page 78 Master’s Thesis - Roger Pallar`es L´opez 5.4. Project Management Methodology The methodology followed to organize and distribute the work over the whole year was based on Agile. The Agile methodology is a way to manage a project by breaking it up into several phases. It involves constant collaboration with all the group and continuous improvement at every stage. Group teams cycle through a process of planning, executing, and evaluating. Concretely, the Scrum methodology was followed. GitHub served as the environment where the project was developed. With a canvas that contained the work to do, the work in progress and the work done, small tasks called issues were assigned to develop this project. Stand up meetings were carried out biweekely, and retro meetings were held once a month. A postdoctoral researched had the role of scrum manager in order to lead the team through the common goals. Moreover, weekely meetings with the lab team and principal investigators were scheduled. Primary resources needed to carry out the explained methodology were the following. First, a lab space and a meeting room were used to held personal meetings and group work. Moreover, Zoom and Slack applications were provided to do videocalls and organize tasks virtually. Second, GitHub served as the platform to share and unify each student project, building a powerful machine learning environment with different tools. Finally, powerful workstations were bought to perform time and compute consuming tasks related to the project. 5.5. Project Costs The economic cost of the project consists of four different aspects: the depreciation of the laboratory and personal computers, the cost of the Harvi simulator license, the cost of the supervisors’ and student’s working time, and finally, an estimation of the electrical energy consumed. Depreciation of computers is calculated from its total price, their lifespan and the total time they were working. For this project, two workstations (a personal one and a shared one with lab members) as well as a personal laptop were used. A useful life of 8 years and 5 years for the workstations and laptop have been considered, respectively. Workstations and personal laptop are thought to be used 8 hours per day, 5 days a week and 48 weeks a year. Taking the 8 years, it is a total of 15360 hours of useful life for the workstations. On the other hand, considering the 5 years for the personal laptop, it is a total of 9600 hours of useful life. The lab workstation was only employed when training and optimizing, which has estimated to be a total of 14 entire days, i.e., 336 hours. Regarding the personal workstation and laptop, both were used the whole workday simultaneously. As stated in the previous section (Section 5.3), the total worked time was composed by 8 hours per day, 5 days a week during 51 weeks. Hence, a total of Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 79 2040 hours within the project. Harvi simulator license expires after one year. Taking the hours of a whole year (24 hours per day, 7 days per week, 52 weeks per year), the license lasts 8736 hours. Since the simulator is not depreciated, it has been assumed that its entire price is attributed to the project. As for the costs related to the student and supervisors, the student worked the 2040 hours derived in the above paragraph. Also, during the task of developing the pipeline, other three students helped on doing so. Therefore, taking from May to November, those three students contributed on 224 hours each. On the other hand, the main supervisor, the director of this thesis, dedicated 2 hours per week in meetings as well as 15 hours of supervision of the thesis writing, which sums up to 117 hours. Moreover, another principal investigator with the role of coadvisor and a postdoctoral researcher also helped on the supervision of this thesis, about 50 hours each. As presented in [38], a graduate research assistant in Massachusetts makes 20 $ /h in average. On the other hand, a postdoctoral researcher is paid 28 $ /h in average. Finally, principal investigators are paid 66 $ /h in average. Furthermore, it must be taken into account that the Massachusetts General Hospital charges with the 68% of all expenses in order to perform research on-site. Finally, the cost of the electricity consumed has been estimated. Power of all equipment has been upper bounded by its respective power supply. The lab workstation has a power supply of 1600 W, the personal workstation a power supply of 650 W and finally, the personal laptop has a charger of 120 W. Furthermore, a light bulb of 40 W has been considered open all the time the student was working. Finally, the price of electricity in Massachusetts has been averaged during 2020 and taken constant, with a resulting value of 0.2 $ /kWh. Note that the variable cost of electricity in Table 5.2 is computed by multiplying the price of electricity by the total power consumed. As the lab workstation was used much less than the other computers and light bulb, a fraction of 336/2040 of its total power is taken. Thus, the total power can be calculated as: Ptot = 1600 ·336/2040 + 650 + 120 + 40 = 1073.53W. The two workstations used were mounted in parts, Table 5.1 shows the summary of their price. Furthermore, in Table 5.2 the total cost of the project is presented. Each cost related to the factors described above is detailed. The total cost of the project is 114009.26 $ (94535.91 e). Page 80 Master’s Thesis - Roger Pallar`es L´opez Table 5.1 Calculation of workstations cost from each component bought. Price of each component is shown on the middle left column. Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 81 Table 5.2 Calculation of the final project cost. Variable costs of computers and licenses are obtained from dividing their fixed cost by their life expectancy in hours. Variable cost of electrical energy is found from its price multiplied by the power consumption of computers and light. Page 82 Master’s Thesis - Roger Pallar`es L´opez Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 83 CONCLUSIONS Reinforcement learning (RL) for decision support has recently emerged for applications into healthcare. For instance, managing invasive mechanical ventilation, learning optimal treatment strategies for sepsis or treating cancer. This thesis focuses on the application of RL in supporting therapy strategies in cardiogenic shock (CS) patients due to decompensated heart failure. In this study, a policy was trained in simulated CS patients in order to learn simplified tailored therapy decisions that recovered the patient’s decompensated state. First, the Burkhoff and Tyberg cardiovascular (CV) hemodynamics model was implemented to simulate CS patients. This model served as environment in which the policy interacted and learned therapy strategies. Second, a system identification tool was developed to estimate nine CV model parameters from real data. In particular, a dataset consisting of 1372 patients who underwent CABG surgery was created. From it, 776341 cardiac cycles with relevant hemodynamic information were extracted and used to first, train an autoencoder, and then, use the encoder to estimate the aforementioned parameters. Results showed that the means of the parameters distribution were strikingly similar to literature parameters. Finally, the deep Q-network (DQN) algorithm was used to train policies on simulated CS patients. Robustness of policies was reinforced by introducing domain randomization during training. Ranges of domain randomization were determined based on the nine estimated CV parameter distributions. Then, an assessment of action importance was carried out by limiting policies to a subset of the whole action space. It was evidenced that actions changing heart rate were less important for restoring cardiac output. Moreover, certain strategies implemented by physicians were also appreciated: the policy learned that introducing intravenous fluids to the patient to increase their blood volume is a relevant strategy to improve cardiac output. On the other hand, evaluation of different reward functions was performed by including different penalty terms. This demonstrated that penalties related to cardiac power consumption and drug administration were necessary to obtain better treatment strategies. Such strategies only included the necessary actions while avoiding undesirable patient states like hypertension. Having presented the obtained outcomes, some limitations of this work should be addressed. Regarding the system identification tool, the ability of the decoder to reproduce simulated pressures was limited to its training domain. The fact that negative CV parameters were estimated, pointed out the lack of generalization of the decoder outside from its training range. Page 84 Master’s Thesis - Roger Pallar`es L´opez Related to the RL framework, the simplification of therapy actions directly affecting the CV parameters reduced high variability in patient-to-patient drug administrations. Although stochastic actions were introduced, a drug administration model sensitive to changes in parameters must be developed to account for the interpatient variability that physicians face. Such a model would allow evaluating whether a policy would be robust enough to face patient-to-patient drug effects when making therapy decisions. In addition, it was demonstrated that domain randomization provides robustness in front of unseen and unexpected environments. However, relying on only simulated data limits the assessment of the policy performance in a real scenario. Future work contemplates first an improvement of the autoencoder. Specifically, retraining the decoder to generalize and achieve better similarity with the simulator. Ideally, it would be desirable to substitute the decoder with the actual simulator. However, this one should be implemented in such a way that could be parallelizable over a GPU and suitable to backpropagate the loss error for neural network training. Moreover, switching to another RL algorithm that accepts continuous actions is also considered. This change, together with a model of the effect of drug administration on CV parameters, would provide a more complex environment that a policy should face to. Finally, a dataset of patient-outcome historical data is sought to be generated. This dataset would serve as a tool to retrain and refine the policy with real physician-to-patient causality relationships, as well as to evaluate the policy performance. The fundamental value of this thesis lies in the implementation and evaluation of a policy that learns tailored therapy decisions from hemodynamic data. Although these strategies have been studied in simulation, the long term goal contemplates the use of clinical data to assess its potential in a real world scenario. A future implementation is envisioned to work on patient’s real time data. By learning the patient’s CV physiology, a policy would recommend therapy decisions to improve and counteract decompensated states that lead to CS. Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 85 ACKNOWLEDGMENTS Firstly, I would like to deeply thank my advisor, Dr. Nicholas Houstis, for making of this past year, difficult for all of us in many ways, an unforgettable experience. I truly appreciate his great advice, guidance and mentorship over the past 12 months. This project would not have been possible without his devotion, perseverance and incommensurable support. He not only guided me through this thesis but, with his passion, he also made learning about cardiovascular physiology enjoyable. I would also like to express my sincere gratitude to Dr. Aaron Aguirre for his constant highly valuable suggestions as well as helping me see the big picture and clinical motivations behind this project. I will always be grateful for both Aaron and Nick for offering us the opportunity to improve our career experiences next to them. I want to thank Erik Reinertsen for his continuous supervision and involvement in the project to create a cohesive team and an enriching and amiable working environment. Working together with Eric, Raimon, Ridwan, Steven and him has been a huge pleasure. I also want to express a word of gratitude to all Aguirre Lab members, for both showing interest on my project and contributing with any valuable inputs. Moreover, I would like to thank Dr. Cecilio Angulo for his advice and supervision of my work. Last, but not least, I want to thank my family and friends for always being there for me and, although being apart, supporting me on my new adventure in the U.S. Page 86 Master’s Thesis - Roger Pallar`es L´opez Applying Reinforcement Learning in Treatment Strategies for Cardiogenic Shock Patients Page 87 REFERENCES [1] Burkhoff, D., and Tyberg, J. V. Why does pulmonary venous pressure rise after onset of LV dysfunction: a theoretical analysis. Am Journal Physiology 256 (August 1993), 1819–28. DOI: 10.1152/ajpheart.1993.265.5.H1819. [2] DORNHORST, A. C., HOWARD, P., and LEATHART, G. L. Effects of dobutamine on hemodynamics and left ventricular performance after cardiopulmonary bypass in cardiac surgical patients. Circulation 6 (October 1952), 553–558. DOI: 10.1161/01.CIR.6.4.553. [3] Doshi, D., and Burkhoff, D. Cardiovascular Simulation of Heart Failure Pathophysiology and Therapeutics. Journal of Cardiac Failure 22(4) (April 2016), 303–11. DOI: 10.1016/j. cardfail.2015.12.012. [4] Foulon, P., and Backer, D. D. The hemodynamic effects of norepinephrine: far more than an increase in blood pressure! Annals of Translational Medicine 6(Suppl 1) (November 2018), S25. DOI: 10.21037/atm.2018.09.27. [5] Frazier, P. I. A Tutorial on Bayesian Optimization. arXiv (July 2018). eprint: 1807.02811. [6] Fu, J., Levine, S., and Abbeel, P. One-shot learning of manipulation skills with online dynamics adaptation and neural network priors. RSJ International Conference on Intelligent Robots and Systems (IROS) (October 2016). DOI: 10.1109/IROS.2016.7759592. [7] Goodfellow, I., Bengio, Y., and Courville, A. Deep Learning. MIT Press, 2016, ch. 6. http://www.deeplearningbook.org. [8] Herring, N., and Paterson, D. J. Levick’s Introduction to Cardiovascular Physiology. CRC Press, Boca Raton, FL, 2018, ch. 1 and 2. Sixth Edition. [9] Hoppensteadt, F. C., and Peskin, C. S. Modeling and Simulation in Medicine and the Life Sciences. Springer, Arizona State University and New York University, 2004, ch. 1. Second Edition. [10] Irpan, A., Rao, K., Bousmalis, K., Harris, C., Ibarz, J., and Levine, S. Off-Policy Evaluation via Off-Policy Classification. arXiv (November 2019). eprint: 1906.01624. [11] Jeter, R., Josef, C., Shashikumar, S., and Nemati, S. Does the “Artificial Intelligence Clinician” learn optimal treatment strategies for sepsis in intensive care? arXiv (February 2019). eprint: 1902.03271.