Continuous blood glucose monitoring sensor online fault detection method based on multi-model fusion
Technical Field
The invention belongs to the technical field of blood glucose monitoring, and particularly relates to an online fault detection method of a continuous blood glucose monitoring sensor based on multi-model fusion.
Background
The Artificial Pancreas (AP) system provides automatic regulation of Blood Glucose Concentration (BGC) for type 1 diabetes (T1D) patients, and it is composed of three major components: a continuous blood glucose monitoring (CGM) sensor, a controller that calculates an insulin infusion rate based on the CGM signal, and an insulin pump that delivers the amount of insulin calculated by the controller to the patient. The patient with T1D can know the fluctuation of blood sugar more comprehensively by continuously monitoring the blood sugar, thereby realizing better blood sugar control. However, in real life, the measurement result of the continuous blood glucose monitoring sensor is influenced by various factors, so that the measurement result is inaccurate, and the artificial pancreas control system infuses wrong amount of insulin according to wrong measurement value, which finally causes the patient to have hyperglycemia and even threaten life in severe cases.
Methods have been proposed for detecting incorrect measurements of continuous glucose monitoring sensors, which are mainly classified into two categories, one being model-based methods that do not require large amounts of historical data, and that determine whether a system has failed by merely modeling blood glucose data and comparing the predicted values of the model with the measured values; while another class is based on data-driven methods that strongly depend on the size and performance of the data set, require large amounts of historical data, and calculate their confidence limits from statistical analysis, a representative of such methods is the PCA method. The currently common modeling methods include an autoregressive moving average method, a Support Vector Machine (SVM), Kalman Filtering (KF), a Gaussian Mixture Model (GMM), Recursive Least Squares (RLS), a model based on a kernel filtering algorithm and the like, most of the methods assume that data meet Gaussian distribution and only consider the influence brought by error information at the current moment, and cannot effectively distinguish the rapid change of blood glucose data and the abnormity of sensor signals.
Disclosure of Invention
Technical problem to be solved
Aiming at the existing technical problems, the invention provides a continuous blood glucose monitoring sensor online fault detection method based on multi-model fusion, which solves the problems of low accuracy of detection results and the like in the prior art.
(II) technical scheme
In order to achieve the purpose, the invention adopts the main technical scheme that:
a continuous blood sugar monitoring sensor online fault detection method based on multi-model fusion comprises the following steps:
s1, acquiring on-line CGM monitoring signal data;
s2, inputting the acquired online CGM monitoring signal data into a multi-model fusion algorithm model to acquire online prediction errors;
s3, combining the obtained online prediction error and the historical prediction error to calculate and obtain an entropy value of the online time;
s4, calculating the obtained entropy value J of the online timei1、Ji2Respectively with the threshold value T of the current momentkl1、Tkl2Comparing;
if the entropy value J of the current timei1、Ji2Not all greater than the threshold value T at the present momentkl1、Tkl2Judging that the current blood sugar monitoring sensor works normally;
if the entropy value J of the current timei1、Ji2Are all larger than the threshold value T of the current momentkl1、Tkl2And judging that the current blood sugar monitoring sensor works abnormally.
Preferably, when the current blood glucose monitoring sensor is judged to work normally, the method further comprises the following steps:
S40A1, secondary detection;
S40A2, return to step S1.
Preferably, when the current blood glucose monitoring sensor is judged to work abnormally, the method further comprises the following steps:
S40B1, returning to the step S1;
and S40B2, replacing the monitoring signal data in the step 1 with the predicted value of the current multi-model fusion algorithm model.
Preferably, the step S40a1 further includes:
a1, calculating two entropy values J of the current timei1And Ji2;
A2, two entropy values Ji1、Ji2Respectively with a threshold value Tkl1、Tkl2Comparing;
if entropy value Ji1And Ji2All exceed the threshold value Tkl1、Tkl2;
Judging that the current blood sugar monitoring sensor works abnormally, replacing a measured value with a predicted value of the model, and reconstructing a model prediction error at the current moment;
otherwise, judging that the current blood sugar monitoring sensor works normally, and updating the parameters of the model by using the measured values.
Preferably, after the step a2, determining that the current blood glucose monitoring sensor is abnormal in operation, the method further includes the following steps:
b1, calculating entropy J of current time1And J2;
B2, judging the entropy J of the current time1And J2If so, execute B3, otherwise execute B4;
b3, judging whether the measured value at the previous moment is a fault value, if not, setting a threshold value as a 3 delta confidence interval of the entropy value in the window, and storing the entropy value at the current moment and the entropy value at the previous moment, otherwise, updating and storing the entropy value at the current moment;
and B4, judging whether the measured value at the previous moment is a fault value, if so, setting a threshold value to be 95% of the maximum change value when the entropy value at the latest moment is reduced, otherwise, setting the threshold value to be reasonable.
Preferably, the entropy J of the current time is calculated in the step B11And J2Also comprises the following steps:
c1, obtaining a model prediction error of the multi-model fusion algorithm model at the current moment;
c2, obtaining model prediction errors of historical time and recent time;
c3, calculating the mean and variance of the prediction errors of the historical time model and the recent time model as p (x) and p1(x) Mean and variance of the distribution;
c4, calculating the mean and variance of the prediction errors of the model including the historical time and the latest time after the prediction error of the model at the current time as q (x) and q1(x) Mean and variance of the distribution;
c5, calculating by using calculation formula of KL divergenceEntropy of previous time J1And J2;
Preferably, the calculation formula of the KL divergence in step C5 is:
wherein p (x) and q (x) are two univariate normal distributions and satisfy p to N (mu)0,σ0) And q to N (mu)1,σ1)。
Preferably, the multi-model fusion algorithm model comprises the following steps:
d1, acquiring blood glucose data g (t) measured by a continuous blood glucose monitoring sensor;
d2, reconstructing the acquired data by using a sliding window with length L to obtain the following input matrix and output matrix:
y (N × 1) bis [ g (L + PH) g (L +1+ PH) ]. g (k)]T(2)
Wherein x (i) ═ g (i) g (i +1) … g (i + L-1) ], N ═ K-PH-L +1 is the number of samples to predict, K is the number of samples of the original time series, PH denotes the number of steps to predict ahead, and i denotes the current time;
d3, respectively modeling the reconstructed data by using SVM and RLS algorithm to generate a predicted value y of the modelSVMAnd yRLS;
D4, calculating the average value of the historical prediction errors of each model;
d5, judging whether the model prediction error of each model at the previous moment is more than 3, if so, executing a step D6, otherwise, executing a step D7;
d6, comparing the prediction errors mean of the two modelssvmAnd meanrlsIf mean, ofsvm<meanrlsAnd the final predicted value of the model is Y ═ YSVMOtherwise Y ═ YRLS’And then the process is ended;
d7, calculating the weight of each model according to the prediction error of each model;
d8, calculating an expression of the model predicted value after multi-model fusion as follows:
Y=ySVM×wsvm+yRLS×wrls
wherein, wsvm+vrls=1。
Preferably, the calculation formula for calculating the mean value of the historical prediction errors of each model in the step D4 is as follows:
wherein, errorsvmAnd errorrlsRespectively predicting errors of the SVM and the RLS model, wherein n is the number of model predicting errors and satisfies that i is larger than n;
preferably, the formula for calculating the weights of the models in step D7 is as follows:
wherein, wsvmThe weight occupied by the SVM model; w is arlsIs the weight taken up by the RLS model.
(III) advantageous effects
The invention has the beneficial effects that: according to the online fault detection method of the continuous blood glucose monitoring sensor based on multi-model fusion, the model prediction value of the current moment is generated through the multi-model fusion method according to the collected historical data, the prediction error of the current moment is analyzed by using the historical error of model prediction, the dynamic threshold updating strategy is designed by considering the dynamics of blood glucose data, and the rapid change of the blood glucose data and the abnormity of the sensor signal can be effectively distinguished. In addition, the invention can process the fault signal, can effectively avoid the insulin pump from injecting wrong amount of insulin according to wrong blood glucose data information, and further reduce the influence on the life safety of the patient.
The multi-model fusion prediction method can improve the prediction capability of the model, reduce the influence of the prediction error of the model on the result, and take the dynamics of blood glucose data into consideration. The support vector machine method can better fit the nonlinear data, but has larger prediction error near an extreme point with larger fluctuation, so the prediction precision of the model is improved by adopting a multi-model prediction method which integrates the two methods based on the analysis.
Drawings
FIG. 1 is a schematic flow chart of a continuous blood glucose monitoring sensor online fault detection method based on multi-model fusion according to the present invention;
FIG. 2 is a schematic flow chart of a multi-model fusion algorithm model in the online fault detection method for a continuous blood glucose monitoring sensor based on multi-model fusion according to the present invention;
FIG. 3 is a schematic flow chart of dynamic threshold updating in a continuous blood glucose monitoring sensor online fault detection method based on multi-model fusion according to the present invention;
FIG. 4 is a schematic diagram of an algorithm flow of a continuous blood glucose monitoring sensor online fault detection method based on multi-model fusion according to the present invention;
FIG. 5 is a schematic diagram of an algorithm flow of a multi-model fusion algorithm model in the online fault detection method for a continuous blood glucose monitoring sensor based on multi-model fusion according to the present invention;
FIG. 6 is a schematic diagram showing comparison results of different models for blood glucose data prediction in a continuous blood glucose monitoring sensor online fault detection method based on multi-model fusion according to the present invention;
FIG. 7 is a schematic diagram of KL divergence-based online fault detection in a continuous blood glucose monitoring sensor online fault detection method based on multi-model fusion according to the present invention;
FIG. 8 is a schematic diagram of a calculation flow of KL divergence in the online fault detection method of a continuous blood glucose monitoring sensor based on multi-model fusion provided by the present invention.
Detailed Description
For the purpose of better explaining the present invention and to facilitate understanding, the present invention will be described in detail by way of specific embodiments with reference to the accompanying drawings.
As shown in fig. 1 and 4: the embodiment discloses a continuous blood glucose monitoring sensor online fault detection method based on multi-model fusion, which comprises the following steps:
s1, acquiring on-line CGM monitoring signal data;
s2, inputting the acquired online CGM monitoring signal data into a multi-model fusion algorithm model to acquire online prediction errors;
s3, combining the obtained online prediction error and the historical prediction error to calculate and obtain an entropy value of the online time;
s4, calculating the obtained entropy value J of the online timei1、Ji2Respectively with the threshold value T of the current momentkl1、Tkl2Comparing;
if the entropy value J of the current timei1、Ji2Not all greater than the threshold value T at the present momentkl1、Tkl2Judging that the current blood sugar monitoring sensor works normally;
if the entropy value J of the current timei1、Ji2Are all larger than the threshold value T of the current momentkl1、Tkl2And judging that the current blood sugar monitoring sensor works abnormally.
In this embodiment, when it is determined that the current blood glucose monitoring sensor is working normally, the method further includes:
S40A1, secondary detection;
S40A2, return to step S1.
In this embodiment, when it is determined that the current blood glucose monitoring sensor is abnormal, the method further includes:
S40B1, returning to the step S1;
and S40B2, replacing the monitoring signal data in the step 1 with the predicted value of the current multi-model fusion algorithm model.
In this embodiment, the step S40a1 further includes:
a1, calculating two entropy values J of the current timei1And Ji2;
A2, two entropy values Ji1、Ji2Respectively with a threshold value Tkl1、Tkl2Comparing;
if entropy value Ji1And Ji2All exceed the threshold value Tkl1、Tkl2;
Judging that the current blood sugar monitoring sensor works abnormally, replacing a measured value with a predicted value of the model, and reconstructing a model prediction error at the current moment;
otherwise, judging that the current blood sugar monitoring sensor works normally, and updating the parameters of the model by using the measured values.
The secondary detection can more comprehensively check whether the work of the sensor is abnormal or not, and the accuracy of the detection result is greatly improved.
As shown in fig. 3: in this embodiment, after the step a2 of determining that the current blood glucose monitoring sensor is abnormal, the method further includes the following steps:
b1, calculating entropy J of current time1And J2;
B2, judging the entropy J of the current time1And J2If so, execute B3, otherwise execute B4;
b3, judging whether the measured value at the previous moment is a fault value, if not, setting a threshold value as a 3 delta confidence interval of the entropy value in the window, and storing the entropy value at the current moment and the entropy value at the previous moment, otherwise, updating and storing the entropy value at the current moment;
and B4, judging whether the measured value at the previous moment is a fault value, if so, setting a threshold value to be 95% of the maximum change value when the entropy value at the latest moment is reduced, otherwise, setting the threshold value to be reasonable.
The dynamic threshold updating strategy provided by the method can effectively distinguish the rapid change of the blood glucose data from the abnormity of the sensor signal.
As shown in fig. 8: in the embodiment, the entropy J of the current time is calculated in the step B11And J2Also comprises the following steps:
c1, obtaining a model prediction error of the multi-model fusion algorithm model at the current moment;
c2, obtaining model prediction errors of historical time and recent time;
c3, calculating the mean and variance of the prediction errors of the historical time model and the recent time model as p (x) and p1(x) Mean and variance of the distribution;
c4, calculating the mean and variance of the prediction errors of the model including the historical time and the latest time after the prediction error of the model at the current time as q (x) and q1(x) Mean and variance of the distribution;
c5, calculating entropy J of current time by using calculation formula of KL divergence1And J2;
The calculation formula of the KL divergence in step C5 in this embodiment is as follows:
wherein p (x) and q (x) are two univariate normal distributions and satisfy p to N (mu)0,σ0) And q to N (mu)1,σ1)。
As shown in fig. 2 and 5: the multi-model fusion algorithm model in the embodiment includes the following steps:
d1, acquiring blood glucose data g (t) measured by a continuous blood glucose monitoring sensor;
d2, reconstructing the acquired data by using a sliding window with length L to obtain the following input matrix and output matrix:
y (N × 1) bis [ g (L + PH) g (L +1+ PH) ]. g (k)]T(2)
Wherein x (i) ═ g (i) g (i +1) … g (i + L-1) ], N ═ K-PH-L +1 is the number of samples to predict, K is the number of samples of the original time series, PH denotes the number of steps to predict ahead, and i denotes the current time;
d3, respectively modeling the reconstructed data by using SVM and RLS algorithm to generate a predicted value y of the modelSVMAnd yRLS;
D4, calculating the average value of the historical prediction errors of each model;
d5, judging whether the model prediction error of each model at the previous moment is more than 3, if so, executing a step D6, otherwise, executing a step D7;
d6, comparing the prediction errors mean of the two modelssvmAnd meanrlsIf mean, ofsvm<meanrlsAnd the final predicted value of the model is Y ═ YSVMOtherwise Y ═ YRLS’And then the process is ended;
d7, calculating the weight of each model according to the prediction error of each model;
d8, calculating an expression of the model predicted value after multi-model fusion as follows:
Y=ySVM×wsvm+yRLS×wrls
wherein, wsvm+wrls=1。
In the embodiment, the multi-model fusion algorithm model generates the model prediction value at the current moment through a multi-model fusion method according to the collected historical data, and analyzes the prediction error at the current moment by using the historical error of the model prediction, so that the detection result is more accurate.
It should be noted that: the calculation formula for calculating the mean value of the historical prediction errors of each model in the step D4 is as follows:
wherein, errorsvmAnd errorrlsRespectively predicting errors of the SVM and the RLS model, wherein n is the number of model predicting errors and satisfies that i is larger than n;
it should be noted that: the formula for calculating the weights of the models in step D7 is as follows:
wherein, wsvmThe weight occupied by the SVM model; w is arlsIs the weight taken up by the RLS model.
1. Performance verification of multi-model fusion prediction method
The method presented in this example was validated on a type I diabetes metabolic simulator at the university of feignia/padova italy. Experimental data were obtained by sampling at five minute intervals, the data set contained 6-day blood glucose data for three types of patients, adult, juvenile and child, and the performance of each model was evaluated by using a one-step prediction method, with the results shown in fig. 6. The comparison result of the model prediction performance by using the single model and the multi-model fusion method is shown in the table 1, and the fitting degree between the multi-model fusion prediction method and the blood glucose data is better compared with the single model prediction method by analyzing the prediction results of the models on the blood glucose data of the three types of patients, so that the rationality of the algorithm provided by the invention is illustrated.
TABLE 1 comparison of prediction Performance of Single model and Multi-model hybrid prediction methods
2. Performance verification of online fault detection algorithms
The continuous blood glucose monitoring sensor has six common fault types, namely spike, drift, step, pressure sensing sensor attenuation, signal loss and stagnation. Wherein the loss and stagnation of signals are easy to be detected, the other four fault signals are randomly added to the normal blood glucose data in a period of 4 hours in the simulation process, the amplitude of the fault signal is set to be 10%, and fig. 7 is a fault detection result of an online fault detection algorithm on the blood glucose data of children. As can be seen from the figure, the detection method provided by the invention can effectively detect small fault signals of four types of faults in time and reconstruct the fault signals so as to reduce the damage caused when the continuous blood sugar monitoring sensor fails and effectively improve the performance of the continuous blood sugar monitoring sensor.
The technical principles of the present invention have been described above in connection with specific embodiments, which are intended to explain the principles of the present invention and should not be construed as limiting the scope of the present invention in any way. Based on the explanations herein, those skilled in the art will be able to conceive of other embodiments of the present invention without inventive efforts, which shall fall within the scope of the present invention.