Full text
1 Becalm: intelligent monitoring of respiratory patients Juan A. Recio-Garcia, Belen Diaz-Agudo, and Arturo Acuaviva-Huertos Abstract—The Becalm project is an open and low-cost solution for the remote monitoring of respiratory support therapies like the ones used in COVID-19 patients. It is a combined architecture based on a Case-Based Reasoning (CBR) decision-making system for the remote monitoring, detection, and explanation of risk situations for respiratory patients using a low-cost non-invasive mask. This paper describes the mask and the sensors that allow remote monitoring. Then, it describes the intelligent decision-making system that detects anomalies and raises early alerts that are visualized and explained to healthcare professionals. This detection is based on the comparison of cases that represent patients using a set of static variables, plus the dynamic vector of the patient time series from sensors. The experiments reported in this paper are based on a synthetic data generator that simulates realistic patients using a synthesis process developed from the analysis of the available clinical literature. This process has been verified with real data and allows the validation of the reasoning system with noisy and incomplete data, threshold values, and life/death situations. Besides, we have evaluated three different distance metrics for the reasoning system in either optimal situations or cold-start and noisy situations. Our results demonstrate promising results and good accuracy for the proposed low-cost method to supervise COVID-19 patients for medical staff. Index Terms—Case-based Reasoning, eXplainable Artificial Intelligence, Artificial Intelligence of Things, noninvasive respiratory device I. INTRODUCTION IN recent years there has been a substantial increase in proposals to apply Artificial Intelligence (AI) to the healthcare industry [1], [2]. This trend has been intensified by the recent events arising from the outbreak of the COVID-19 crisis [3]– [5]. COVID-19 patients in the hardest pandemic time could not be cared for in hospitals with adequate technical means, and healthcare professionals had not been able to do individualized supervision [6], [7]. The need, the high cost, and the difficulties for this individualized supervision are motivation aspects behind the Becalm project: an open project promoted by a non-profit organization after the COVID-19 pandemic1. BeCalm aims to provide an open and low-cost AI solution for the monitoring of oxygen All authors belong to the Universidad Complutense de Madrid (UCM). Prof. Diaz-Agudo and Recio-Garcia are associated to the Institute of Knowledge Technology of the UCM (e-mails: [email protected], be- [email protected], ar[email protected]) 1IDATIS. https://www.idatis.org/proyecto-becalm/ Fig. 1: The Becalm mask is a low-cost solution for monitoring COVID-19 patients therapies for respiratory patients when human healthcare resources are not fully available, for example, in developing and underdeveloped countries, rural areas, or overwhelmed healthcare infrastructures. Becalm is based on open-source software contributions and widely available components. The Becalm mask (Figure 1) is an Internet of Things (IoT) device consisting of a non-intrusive ventilator mask, a pulse oximeter, a CO2concentration meter, and a pressure sensor. This mask can use both local or wide area network protocols to transmit the information provided by the sensors to a central point of control that allows the remote monitoring by healthcare staff of hundreds of patients at the same time without the need to move and be physically close to them. This individualized medical supervision is essential for fast assistance in risky situations. The centralized remote monitoring system is based on an intelligent decision-making system able to raise early alerts to healthcare professionals. This paper describes the implementation of the decisionmaking system for the remote monitoring and detection of respiratory problems for patients using the Becalm mask through Case-Based Reasoning (CBR). CBR is an experiencePREPRINT
2 based approach to solving new problems by adapting previously successful solutions to similar problems [8]. There are previous applications of CBR for the detection and diagnosis of COVID-19, as well as other infectious diseases [9]–[11]. These existing models are based on cases that are encoded numerically or categorically using vector attributes representing disease symptoms. This way, the Becalm decision system combines static descriptive variables and dynamic values from sensors and manages the information in the form of time series, such as oscillations in peripheral oxygen saturation or pulsations in a certain window of time. One advantage of our CBR proposal is that it provides a general scheme that can be integrated with different sets of clinical IoT sensors, not only for COVID-19 patients but also for other contexts and applications. Although in this paper, we will focus on the monitoring of respiratory anomalies caused by COVID-19, the CBR technique is easily applicable to other situations in which static clinical data assembles with time series from sensors. The use of CBR has the additional benefit of providing explanations about the causes of the alert that other blackbox decision-making models, such as neural networks, are not able to provide. There is a huge body of recent works on CBR demonstrating its ability to provide an explanation, transparency, and trust of the reasoning results based on the underlying examples, particularly in the healthcare domain [12], [13]. Another contribution of this paper arises from an insurmountable situation: the lack of real patient data to experiment and validate the research. It was impossible to get a proper real data set from patients, mainly because the mask device was improvised during the worst days of the pandemic due to the current emergency medical situation and the limited resources. The experiments reported in this paper are based on a synthetic data generator (described and evaluated in Section III) that simulates realistic patients using a synthesis process developed from the analysis of the available clinical literature. This process is verified through the comparison to a real data set and has the clear advantage of allowing us to extensively validate and test the alert and explanation systems with limit values and life/death situations. Section II introduces the Becalm mask, its IoT components, and the type of data and parameters collected. Section III describes the synthetic data generator that we have developed to be able to simulate the cases collected using the Becalm mask. Section IV describes the proposed CBR approach to monitor and detect situations of patients that are potentially at risk of suffering some deterioration of the respiratory disease. Section V presents an empirical evaluation of the CBR system. Section VI focuses on the explainability of the monitoring process to healthcare professionals, and Section VII concludes the paper and outlines some lines of future work. II. BECALM MASK The Becalm mask is an IoT solution consisting of a nonintrusive ventilator (NIV) device using a low-cost commercial scuba diving mask, a pulse-oximeter, a CO2concentration Fig. 2: Components of the Becalm mask meter, and a pressure sensor. The project also integrates a simple Raspberry Pi computer board to manage hardware resources and transmit the data to a central server. Figure 2 shows all the components required to build the mask. All these components are widely available or can be 3D printed. This paper focuses on the software CBR solution for the intelligent monitoring of patients. In this section, we provide a brief functional description of its IoT components, whose technical details can be found at the project’s open repository 2. •Non-intrusive ventilation. The fan mask has been adapted from a scuba broadly available diving mask. This mask has been used in other proposals to solve the problem of shortage of respirators during the crisis caused by the COVID-19 pandemic [14], [15]. •Pressure sensor. The most vital measurement during monitoring is the mask internal pressure (MIP) which provides details on the correct operation of the mask, as well as possible problems that the patient may experience. The pressure monitoring in the Becalm mask is provided by the BMP280 sensor developed by BOSCH3. This sensor is capable of measuring atmospheric pressure, as well as temperature. Its small size and low consumption make it ideal for application in non-intrusive respirator masks. •Pulse Oximeter and Heart-Rate Sensor. The pulse oximeter is a medical device that allows peripheral oxygen concentration (SpO2) to be monitored nonintrusively. Concretely, the Becalm mask uses the MAX30100 Oximeter and Heart-Rate Sensor4. It is also capable of indicating the heart rate and pulse of the patient to be monitored. The value of peripheral oxygen 2https://github.com/idatis-org/becalm-station 3https://www.bosch-sensortec.com/products/environmentalsensors/pressure-sensors/bmp280/ 4https://www.maximintegrated.com/en/products/sensors/MAX30100.html
RECIO-GARCIA et al.: INTELLIGENT MONITORING OF RESPIRATORY PATIENTS 3 saturation can alert clinicians to improperly assisted respiration, while heart rate can indicate a patient’s stability. •Air quality sensor. During monitoring, it is vitally important to ensure that not only the vital signs seem adequate for a patient, but also to be able to guarantee the quality of the air that they are consuming. Thus, we use carbon monoxide (CO2) concentration measurements capable of estimating air quality. More specifically we use the Adafruit CCS811 gas sensor5, that is capable of monitoring air quality in fast cycle times and with low energy consumption. III. SYNTHETIC PATIENT DATA GENERATOR Becalm experimentation requires evaluating the system with limit values and life/death situations. A collateral contribution of this paper arises from the requirements of evaluating and experimenting with different computational and representation techniques for patient data. Although some testing data have been collected using the Becalm respiration mask, our goal is to be able to obtain a sufficiently complete and extensive database on which to perform experimental tests. In this section, we describe a procedure to realistically generate an artificial database that simulates patients and critical situations to be able to evaluate the system performance within different techniques and algorithms emulating heterogeneous situations. The goal of this generation process is to be able to characterize how monitored parameters can vary for the subjects in real-time (e.g. peripheral oxygen saturation or pressure in the mask), simulating scenarios of rest, suffocation, hyperventilation, or other conditions. The following subsections first summarize the patient variables and values obtained from the sensors of the Becalm monitoring system (described in Section II), introducing a mathematical model that formalizes it. Subsequently, we introduce the strategy used to generate a time series simulating the hypothetical evolution of patients, and its validation through the comparison to a real dataset. A. Variables Becalm mask allows the monitoring of different parameters related to dynamic spirometric factors of the patient such as mask pressure, CO2emission, or peripheral oxygen saturation (SpO2). Additionally, we consider other descriptive static variables of the patient: age, height, sex, and tobacco consumption. These parameters, described below, will be grouped into a feature vector that represents the state of a patient. 1) Static descriptive variables: •Height. According to existing literature [16], we can model it as a normal distribution (Male ∼N[171.0,5], Female ∼N[159.5,5] cm). •Age. We consider that it follows a discrete uniform distribution within range, Age ∼U(16,65) [16]. •Sex. An evenly distributed binary variable. •Tobacco consumption. Although this variable may be correlated to the previous ones, we simplify its representation as a binary value distributed according to a 20:100 5https://learn.adafruit.com/adafruit-ccs811-air-quality-sensor ratio (smokers/non-smokers) based on averaging existing studies [17]. 2) Time series features:While using the mask the sensors capture data that are recorded in time series using different time windows. The CBR system reasons with knowledge about the evolution of these dynamic variables such as the heart rate or the pressure inside the mask. Each case represents one patient and the different time series characterize the evolution of this patient. •Resting heart rate. A normal resting heart rate for adults lies somewhere between 60 and 100 beats per minute (bpm), and varies based on age group and gender [18]– [20]. Therefore, we will consider a normal distribution RHR ∼N(75,4) bpm. •Carbon dioxide inside the mask. Average values of indoor CO2are between 300-400 ppm (parts per million), being 1000 ppm its limit to avoid physical damages [21]. Additionally, there is some consensus in the literature about hypoventilation and breathing resistance in ventilators, the latter being able to contribute to the rebreathing of CO2and thus increasing the concentration of the gas in the body to symptomatic levels [22]. Thus, considering the possible impact of the mask on respiratory function, we will set the possible resting carbon dioxide values of a subject following a normal distribution CO2∼ N(450,10) ppm. •Peripheral oxygen saturation.SpO2is defined within range (0,100] and represents the percentage of oxygencarrying hemoglobin in the blood relative to the total amount of hemoglobin. This variable allows estimating if the respiratory behavior is being adequate. According to the available literature, we can define the following reference distributions: RefSpO2(male)∼N(97.1,0.5) and RefSpO2(female)∼N(96.6,0.5) [23]–[32]. However, these studies also point out that the peripheral oxygen saturation depends on a multitude of variables, such as age, race, physical condition or smoking, being age and tobacco consumption the most relevant. Age is correlated to the decrease of oxygen saturation, whereas tobacco consumption may represent a significant variation. Therefore, we modify the previous normal distribution as it follows: SpO2=RefSpO2(sex)−age maxAge −itcSpO2(sex)(1) where the impact of tobaco consumption depends on the sex: itcSpO2(male)≈ −0.7% and itcSpO2(female)≈ −0.4% for smoker patients [31], [32] and itcSpO2= 0 otherwise. Additionally, age maxAge represents the impact of age in the oxygen saturation. •Mask Internal Pressure. This variable ranges from 100500 y 101500 Pascals according to experimentation using the Becalm device and unfortunately lacks standardized reference values. However, it is possible to correlate it with the forced vital capacity (FVC) which is the amount of air that can be forcibly exhaled. Again, this variable is influenced by other parameters such as age, height, tobacco consumption or sex [33], [34]. From
4 Variable Interval Variability Source RHR [60,100] N(0,2) [36] SpO2[93,100] N(0, .75) [37] CO2[300,900] N(0,7) [21] MIP [100900,101100] N(0,10) [33], [34] TABLE I: Configuration parameters for the reference series. the analysis of existing reports about its influence we can estimate FVC as: FVC =li(age, sex)−itcF V C (2) where the li() function is the linear interpolation of the tabular data reported in [35] and itcF V C represents it the impact of tobacco consumption (in our setup itcF V C = 0.1). Once the FVC is estimated we can correlate the mask internal pressure using a transformation function that re-scales the FVC value from its original domain to the MIP range: MIP =transform(FVC )(3) transform : [2.8,5.2] →[100500,101500] B. Temporal series generation As we have described, each case records variables that evolve over time during the monitoring of each patient. Therefore, we will assume that these values should be stable when there is no medical emergency, but define a marked variation in the other case. We generate synthetic time series to simulate the use of the mask, focusing on generating appreciable variations in the values of the variables monitored by the Becalm mask sensors. 1) Reference series:are those temporal series generated to simulate a non-danger state for the patient. The generation process is defined as follows: 1) Define the reference [min, max]interval of the variable. For example, the heart rate variable ranges from 60 to 100 bpm as defined in the previous section. 2) Define the initial value p0and the length of the series n. 3) Generate the following element with: pi=pi−1+S+V+J where (S)inusoidal reproduces a smooth repetitive oscillation S∼sin(i), and (V)ariability follows a normal distribution V∼N(µ, σ). Finally, (J)ittering adds random noise. In case pi∈ [a, b]that value is discarded and a new point is generated. Table I presents the configuration parameters used to generate the reference series for each variable. 2) Anomalous series:simulate the scenario of a possible failure of the organism. We simulate a marked variation in some of the variables. The time series reporting such anomalies will include values outside the resting range defined in the previous subsection. These anomalies can be identified as values above the upper limit (series that we will call Variable Decrement Interval Increment Interval Variability RHR [30,80] [80,130] Γ(2,2) SpO2[85,90] -Γ(2, .3) CO2[10,400] [600,1000] Γ(2,7) MIP [100800,101000] [101000,101200] Γ(5,10) TABLE II: Configuration parameters for the incremental and decremental series. incremental) or below the lower limit (decremental series). To reproduce such anomalous series with substantial incremental or decremental variations, we can use a gamma distribution as follows: 1) Define the reference [min′, max′]anomalous interval of the variable. For example, an anomalous heart rate above the reference range can be defined as [100,130]. 2) Define the initial value p0an length of the series n. 3) Generate the following element with pi=pi−1+S+t·V+J where t= 1 for incremental series and t=−1 otherwise. (S)inusoidal reproduces a smooth repetitive oscillation S∼sin(i). (V)ariability follows a gamma distribution V∼Γ(α, λ). And (J)ittering is a random noise function. Once the data points are below the min′ or above the max′anomaly limits we can apply the same procedure than regular series within range [min′, max′]. Table II presents the configuration parameters used to generate the incremental or decremental series for each variable. Parameters reported in Tables I and II have been inferred from the analysis of existing literature. Nevertheless, they can be re-configured according to the criteria of the medical expert to particularize the simulation to a custom segment of the population. C. Dataset validation In order to validate our synthetic time series to simulate the use of the mask, we have compared the resulting series to a real dataset. Although there are no validated datasets available for the C02and MIP values, as they are completely dependent on the type of mask being used, we can find reference datasets for the heart rate and saturation variables. Concretely, we have chosen the BIDMC PPG and Respiration Dataset [38], which has been used to evaluate the performance of different algorithms for estimating respiratory rate. This dataset contains signals extracted from the much larger MIMIC II matched waveform Database [39], acquired from critically-ill patients during hospital care at the Beth Israel Deaconess Medical Centre (Boston, MA, USA). The validation is based on the hypothesis that our synthetic method generates series that are very close to the real ones found in the BIDMC dataset. Therefore, we have compared the 53 recordings in BIDMC for the RHR and SP O2variables to a synthetic dataset generated through the method proposed in Section III. Results are shown in Figure 3 which shows the distribution of the similarity values between each record of the
RECIO-GARCIA et al.: INTELLIGENT MONITORING OF RESPIRATORY PATIENTS 5 (a) Resting Heart Rate Sim. Function Mean Std Min 25% 50% 75% Max Euclidean 65.32 21.14 43.66 52.79 59.08 67.01 152.13 Pearson 0.50 0.18 0.05 0.37 0.57 0.62 0.76 Slope 6.79e-5 7.91e-5 2.15e-7 1.38e-5 4.02e-5 9.63e-5 3.08e-4 (b) Peripheral oxygen saturation Sim. Function Mean Std Min 25% 50% 75% Max Euclidean 18.74 9.31 1.00 12.25 17.66 27.23 39.59 Pearson 0.52 0.19 0.04 0.42 0.53 0.66 0.89 Slope 1.04e-5 2.27e-5 5.82e-5 1.80e-6 4.25e-6 7.82e-6 1.47e-4 Fig. 3: Histogram distribution and descriptive statistics for the similarity values between each record of the BIDMC dataset and its most similar time series in the synthetic dataset (n=500) for the RHR (a) and SP O2(b) variables. BIDMC dataset and its most similar time series from the synthetic one. For each variable, we display the minimum similarity according to the three functions used by the casebased reasoning decision-making system presented in the next section: Euclidean, Pearson, and Slope-comparison. As we can observe, the Euclidean distance -that will be later confirmed as the best similarity strategy in Section Vachieves very good results. Pearson similarity is not so good, probably due to the jittering effect of the time series, whereas slope (the baseline metric) does not provide significant results. IV. CASE BASED REASONING FOR PATIENT MONITORING Case-based reasoning (CBR) is a well-known AI reasoning and learning paradigm that is inspired by memory-based human problem-solving in which instances of earlier problemsolving are remembered and applied to solve new problems. [40], [41] The fundamental assumption of CBR is that similar problems have similar solutions: a patient with similar symptoms will have the same diagnosis, or the price of a house with similar accommodation and location will be similar, and similar trials provide reusable decisions based on legal precedents [42]. In this way, specific experiences are memorized and later remembered and reused when similar situations arise. This approach contrasts with rule-based or theory-based problem-solving in which knowledge of how to solve a problem is applied. A doctor diagnosing a patient’s symptoms may apply knowledge about how diseases manifest themselves, or she may remember a previous patient who demonstrated similar symptoms and thus apply a case-based Fig. 4: General schema of the CBR process. approach. One additional advantage of the CBR approach is the interpretability of results, as one or more previous patients are provided as sustainable evidence [12]. In the domain of this paper, the CBR assumption assumes that similar patient situations will have similar evolution. The similarity is a key aspect in CBR as a new unknown situation is compared with previous cases to predict their evolution and thus detect, alert and explain different anomalous situations. Cases in the case base encode the information referring to the clinical situation of the patient (as it was described in Section IIIA), subsequently allowing us to understand the reason why the health status of a certain subject deteriorates or improves. According to the available medical literature, it is common to find correlations when comparing clinical conditions between patients, and mostly intra-patients [43]–[45]. For this reason, when sufficient data is available, we will consider comparing a new case to be analyzed with past cases from other patients and previous states of the same. The next subsection describes the representation of a case using static and dynamic variables, plus the vector of the time series. The rest of the sections cover the CBR process of the Becalm anomaly detection system. As Figure 4 illustrates, our CBR process follows the typical 4Rs stages [41] consisting of (1) an initial retrieval step that compares the query to the previous cases stored in the case base using a similarity function, (2) a reuse step where solutions from the most similar cases are combined to provide a solution to the given query, (3) an optional external revision of the proposed solution by a domain expert, and (4) the last step consisting on storing the confirmed new case (query+solution) in the case base. A. Case representation We define a case Cifor a patient ias a description Di that groups numerical elements and time series referred to the
6 patient together with the anomalies (A) to be reported to the healthcare professional. It can be expressed as: Ci=⟨Di, A⟩ The description of the patient encodes the variables defined in Section III-A: Di=⟨sdv, {RHR}N t=0,{CO2}N t=0,{SpO2}N t=0,{MIP }N t=0⟩ where sdv contains the static descriptive variables: height (h), age (a), sex (s), and smoker (m). {RHR}N t=0 is a series of Nelements referring to the variation of the heart rate of the patient i-th in the last interval of specified time, {CO2}N t=0 is a time series of elements that define the variation in the amount of carbon dioxide emitted by the patient in the last period of time, {SpO2}N t=0 is the time series referred to the variation of the peripheral oxygen saturation and {MIP}N t=0 that of the variation in pressure within the mask. Note that in the previous definition, the concept of time period to which the time series refer to has not been specified on purpose. In general, you can define a time mesh based on seconds, minutes or hours, setting the number of intervals created as N. The solution of the case encodes the class corresponding to the anomaly detected within the case. It can be any of the following values: ok (no anomaly detected), RHRinc , RHRdec ,SpO2dec ,CO2inc ,CO2dec ,MIPinc ,MIPdec . B. Similarity based retrieval Case retrieval computes the distance between a clinical query and the cases representing medical conditions for other patients. Next, we describe similarity metrics for each variable and how they are combined. 1) Case similarity and comparison:There are two numeric variables that refer to the value of height and age. Both values can be represented as natural numbers greater than zero, allowing a simple comparison between attributes using the usual Euclidean distance or any other analogous metric. For Boolean variables, we use equal similarity. More interesting is the comparison of temporal series. In the scientific literature referring to the study of data related to time series there are many different techniques [46]–[50]. However, among all of them, we will highlight the comparison using metrics derived from the Lpor Minkowski norm for its simplicity and its direct applicability to our case study. Note that even though the Lp is coordinate independent from the vector, the order in the series {x}n iand {y}n idetermines the values of the distance. We will restrict ourselves to measurements of patients in the same time horizon so that it is not necessary to use techniques such as Dynamic Temporal Alignment or correction factors to adjust the series, and these can be compared directly. In turn, it is not necessary to apply any correction to the segments to align the series, since we will assume equispaced intervals that correspond to the same time horizon obtained for all patients. To compute the similarity between cases we compute a similarity function between the different attributes of cases Ciand Ck: L(Ci, Ck) = X j∈Vi∩Vk sim(Dj i, Dj k) card(V)(4) Fig. 5: Impact of k parameter. The three different similarity metrics are portrayed: euclidean distance (blue), Pearson correlation (orange) and slope comparison (green). where Viand Vkrepresents respectively the set of variables describing each case iand k,Dj iand Dj kare the values of the j-th attribute for each i-th and k-th description of the case, and sim(·,·)is the similarity function that computes the distance for numerical variables and series. This approach is designed to effectively minimize learning over-generalization, and it is based on information retrieval techniques well-known in the field [51]–[53]. In particular, for our case study, we will compare three different distance metrics: Euclidean distance, Pearson correlation, and slope correlation. Being the latest, a basic metric based on the comparison of the slopes corresponding to the linear regression of the data series. 2) Case reuse:The following step in the CBR cycle is solution reuse. Here, we have defined a simple voting strategy that aggregates the anomalies [A1, . . . , Ak]of the k-nearest neighbors of the query: sv(A1, . . . , Ak) = arg max x |{x∈ ∪i∈{1,...,k}Ai}|.(5) The CBR process designed for the BeCalm mask and described in Figure 4 also includes a revision stage where a health professional confirms the outcome of the decisionmaking engine. This stage will be implemented once the platform is deployed in real scenarios. Finally, the last stage of the CBR cycle is the retention of the new solved case in the case base. Once, we have defined our CBR process, the following section presents its experimental evaluation V. EXPERIMENTATION In order to test the different strategies we run an experiment against a synthetically spawned sample of 5000 random patients. These simulations were provided by the generator described in Section III and tagged with four different classes: non-danger state, anomalous state generated by CO2incremental series, and/or by pressure incremental series. Note that as part of the data preprocessing, we also performed feature scaling to ensure that variables with a broad range of values do not disproportionately contribute to the explanation. In particular, we applied min-max normalization over the different values.
RECIO-GARCIA et al.: INTELLIGENT MONITORING OF RESPIRATORY PATIENTS 7 precision recall f1 CO2dec 0.92 0.92 0.92 CO2inc 0.90 0.97 0.93 RHRdec 0.97 0.95 0.96 RHRinc 0.95 0.88 0.91 MIPdec 0.98 0.93 0.95 MIPinc 0.94 0.93 0.94 ok 0.60 0.73 0.66 SpO2dec 1.00 0.93 0.96 accuracy 0.91 average 0.92 0.91 0.91 TABLE III: Global results using 10% hold-out cross validation and the Euclidean similarity metric (k=3) Fig. 6: Confusion matrix corresponding to Table III: 10% hold-out cross validation and Euclidean similarity metric (k=3). Experimentation has been structured into three phases corresponding to the analysis of (1) optimal configuration, (1) coldstart behavior, and (2) noise tolerance. All these experiments evaluated performance using 10% Hold-out cross-validation. A. Optimal configuration The first analysis corresponds to the performance of the three similarity metrics according to the kparameter. This evaluation aims to find the optimal configuration of our system. Accuracy results are displayed in Figure 5, where we can observe that Euclidean distance is clearly the most efficient similarity strategy, being k= 3 the optimal configuration for the number of retrieved neighbors, as higher values do not report significant improvements. Pearson achieves an accuracy close to 60% and slope-based similarity does not obtain relevant results. Following the previous results, we performed an in-deep analysis of the performance with the optimal configuration (k= 3 and Euclidean distance). Table III reports the performance of the CBR system according to standard evaluation metrics (precision, recall and f1-score). As we can observe, the average accuracy is .91, a very good figure considering a theoretical baseline of 12.5% corresponding to a random 8-class classifier. As expected, most of the misclassifications correspond to the ’ok’ class, leading to false negatives that must be overcome through human supervision. B. Cold-start behaviour The next evaluation simulates the learning process of our CBR system, analyzing its behavior as the case base grows by adding new randomly generated cases. This evaluation is aimed to evaluate the cold-start scenario when few cases are available. This way we begin with 10 patients belonging to each class, ending up with a case base of 500 patients. Figure 7 shows the evolution of accuracy against the addition of new cases for the three proposed similarity approaches. Results show that the optimal configuration using Euclidean distance is able to achieve acceptable performance in the cold start situation when there are few similar cases available in the case base. After the cold start situation, the experiments show how the model performance quickly stabilized. C. Noise tolerance Following evaluation analyses tolerance to missing or incorrect sensor readings. This analysis is quite significant as the BeCalm mask has been designed to be used remotely, by sending sensor readings to the centralized monitory repository that uses the case-based anomaly detection system presented in this paper. Therefore, this distributed architecture may have problems of incorrect or missing sensor readings, together with problems derived from the transmission of these readings using either local or wide area network protocols. This way, the CBR system must be tolerant to this kind of errors. To evaluate the impact of noisy readings in the performance we have simulated two different types of errors: •Missing readings. This error simulates that readings are not received by the centralized monitoring system due to either sensor or transmission failures. In this case the system uses the latest received value: pi=pi−1. •Erroneous readings. In this scenario sensor readings are incorrect and do not reflect the actual value of the variable. This type of error is usually rooted in an incorrect sensor reading, as transmission protocols include redundancy checks to avoid accidental changes to raw data. To simulate this error we use a random value within the data range of the time series: pi=random() Figure 8 reports the accuracy of our anomaly detection system with levels of noise starting from the 75% of the raw data. This figure shows that our case-based approach is very tolerant of missing values. This is a coherent result as our methods are designed to identify the tendencies of time series, and in this case, the previous value is used when no reading has been received. Here missing values do not change the tendency of the series because it keeps stable until a new value is received. On the other hand, erroneous readings do change the tendencies and therefore the evaluation reports a very poor performance. VI. INTERPRETABILITY OF THE CASE-BASED ANOMALY PREDICTION SYSTEM In the domain of this paper, it is extremely important to explain the system’s predictions to be able to trust them.
8 Fig. 7: Visual plot analyzing the learning process of the CBR system. The three different approaches for the similarity computation are portrayed: euclidean distance (blue), Pearson correlation (orange) and slope comparison (green). Y-axis represents accuracy. Fig. 8: Noise evaluation. X-axis represents the level of noise (percentage of raw data) that was introduced in the time series either simulating missing or erroneous readings. The optimal (noise-free) accuracy is also portrayed. Y-axis represents accuracy. Especially because healthcare professionals make a decision based on the predictions and the results of this decision concern human safety. A machine learning model is better interpretable than another model if its decisions are easier for a human to comprehend than decisions from the other model. Interpretability can be defined as the degree to which a human can consistently predict the model’s result [54]. The higher the interpretability of a machine learning model, the easier it is for someone to comprehend why certain decisions, or predictions, have been made. At a high level, the literature distinguishes between two main approaches to interpretability: •model-specific (also called transparent or white box) models •model-agnostic (post-hoc) surrogate models to explain black box models [55]. CBR is typically considered as an interpretable model [56] as similar cases can be used as supporting evidence and, then, as explanations themselves. Using cases to explain would be model-specific explanation method as cases are used as explanations. Some other approaches, separate the explanations from the machine learning model (= model-agnostic methods) and use CBR as a post-hoc explanation model. For example, in [57] authors make a review of the twin-systems post-hoc explanation-by-example method. In twin systems, a black-box model is explained by “twinning” it with a more interpretable CBR system, by mapping the feature weights from the former to the latter. When reviewing the eXplainable Artificial Intelligence (XAI) literature we also find out that many approaches recognize that the context of an explanation situation and the goal of the user in that situation, influence what is and what is not a good explanation [56]. Our approach to explanation aims to generate personalized visual reports to explain what the data from the sensors tell us about a patient and their context, patterns in data, how a patient evolves in time, how they relate with its context, and why this patient is similar or different regarding others. We propose to personalize the explanation, using visual plots that are better than others for a particular goal (temporal evolution, current state, comparison with other patients), for the type of user – patient, doctor, or data scientist– and for the type of data that we want to explain. Explanation reports can be personalized using different user profiles. The doctor’s explanation report contains the following information: •The query (patient) and the retrieved similar case data. The report relates the patient with other patients already diagnosed who present a similar clinical state. •A visual representation of the comparison of the most significant variables used to conclude that the patients were similar. This can range from bar charts to dot graphs, depending on the attribute type compared. •A textual explanation for the anomalies detected, generated from adjusting the case description and the types of alarm from the already classified past case in the knowledge base. To illustrate this process we have created a UI prototype that exemplifies how detected anomalies are explained to health professionals. Figure 9 contains a screenshot of this application. It has been designed as a responsive web-app to be executed remotely using different types of devices. The explanation report shows an example where patient 10 (63 years old non-smoker and 177 cm tall) is motorized and our case-based anomaly detection system identifies two patients with a similar evolution. Therefore, the anomalous series are highlighted (red color) together with the previous evolution of these similar patients (light red). Additionally, the system generates a textual description of the anomalies being detected and proposes a response action. This suggested action is computed using the type of anomaly assigned to the retrieved past case when the case was retained in the CBR learning cycle. VII. CONCLUSIONS AND FUTURE WORK In this paper, we have introduced the Becalm project as a low-cost solution for monitoring COVID-19 patients. We have described the mask and the sensors that allows remote monitoring. An intelligent decision-making system based on Case Based Reasoning (CBR) is able to raise early alerts to the healthcare professionals and generate personalized explanations. One advantage of our CBR proposal is that it provides
RECIO-GARCIA et al.: INTELLIGENT MONITORING OF RESPIRATORY PATIENTS 9 Fig. 9: User interface generated to assist the physician when diagnosing a new patient. The evolution of the patient being diagnosed is depicted using line charts over a time period. In case anomalies are detected, the anomalous time series corresponding to the retrieved past cases which suggest what issue might be facing the patient is also shown. A textual post-hoc explanation is also automatically generated. a general scheme and allows an automatic and autonomous process of monitoring patients in real-time. In this paper, we have specifically described and evaluated an application for monitoring of respiratory anomalies caused by COVID-19. However, the CBR technique is novel, reusable, and easily applicable to other situations in which static clinical data assembles with time series from sensors. Cases in the CBR system combine static descriptive variables, and dynamic values from sensors, and manage the information in the form of time series, such as oscillations in peripheral oxygen saturation or pulsations in a certain window of time. One of the greatest challenges in CBR systems is similarity computation. We have proposed three different metrics and evaluated their performance to obtain an optimal configuration of the system. We also have evaluated the behavior of the system in cold-start scenarios, when few cases are available, showing that the proposed method is suitable. Finally, as BeCalm has been designed to work remotely we have tested the noise tolerance of our anomaly detection system. Results demonstrate that this approach is able to manage noisy signals without losing significant performance. As future work, we will apply user groups or profiles to make specific comparisons inter and intra-groups. For example, the system could store data referring to the elderly, marking this profile and allowing an instance to be compared only with the data of a certain group. The use of CBR has the additional benefit of providing explanations about the causes of the alert. We have described the explanation system and illustrated it with examples, but as future work, we have planned a complete evaluation of the quality of the generated explanations with healthcare professionals. Additionally, we will compare its performance with other Machine Learning techniques such as Artificial Neural Networks. This comparison will let us determine the benefits of the performance-explainability trade-off achieved by the CBR approach. Also as future work, BeCalm could be validated with respect to reference medical devices, following a well-defined test protocol and deriving the metrological performance of the whole system, for each of the measured quantities. Such a consideration could be added here. VIII. APPENDIX The complete source code, datasets, and evaluation code of the case-based anomaly detection system for the BeCalm mask presented in this paper, together with the prototype of the explanation UI, are available at: https://github.com/ BOSCH-UCM/BeCalm